vl.c: Don't print errno after failed qemu_chr_new()
The qemu_chr_new() function doesn't set errno on failure, so don't print strerror(errno) on the error handling path when dealing with the -serial, -parallel and -virtioconsole arguments. This avoids nonsensical error messages like: $ ./arm-softmmu/qemu-system-arm -serial wombat qemu: could not open serial device 'wombat': Success We also rephrase the message slightly to make it a little clearer that we're expecting the name of a QEMU chr backend rather than a host or guest serial/parallel/etc device. Reported-by: Christian Müller <christian.mueller@heig-vd.ch> Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
This commit is contained in:
parent
7ff7563fc1
commit
52d06136bd
12
vl.c
12
vl.c
@ -1984,8 +1984,8 @@ static int serial_parse(const char *devname)
|
|||||||
snprintf(label, sizeof(label), "serial%d", index);
|
snprintf(label, sizeof(label), "serial%d", index);
|
||||||
serial_hds[index] = qemu_chr_new(label, devname, NULL);
|
serial_hds[index] = qemu_chr_new(label, devname, NULL);
|
||||||
if (!serial_hds[index]) {
|
if (!serial_hds[index]) {
|
||||||
fprintf(stderr, "qemu: could not open serial device '%s': %s\n",
|
fprintf(stderr, "qemu: could not connect serial device"
|
||||||
devname, strerror(errno));
|
" to character backend '%s'\n", devname);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
index++;
|
index++;
|
||||||
@ -2006,8 +2006,8 @@ static int parallel_parse(const char *devname)
|
|||||||
snprintf(label, sizeof(label), "parallel%d", index);
|
snprintf(label, sizeof(label), "parallel%d", index);
|
||||||
parallel_hds[index] = qemu_chr_new(label, devname, NULL);
|
parallel_hds[index] = qemu_chr_new(label, devname, NULL);
|
||||||
if (!parallel_hds[index]) {
|
if (!parallel_hds[index]) {
|
||||||
fprintf(stderr, "qemu: could not open parallel device '%s': %s\n",
|
fprintf(stderr, "qemu: could not connect parallel device"
|
||||||
devname, strerror(errno));
|
" to character backend '%s'\n", devname);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
index++;
|
index++;
|
||||||
@ -2041,8 +2041,8 @@ static int virtcon_parse(const char *devname)
|
|||||||
snprintf(label, sizeof(label), "virtcon%d", index);
|
snprintf(label, sizeof(label), "virtcon%d", index);
|
||||||
virtcon_hds[index] = qemu_chr_new(label, devname, NULL);
|
virtcon_hds[index] = qemu_chr_new(label, devname, NULL);
|
||||||
if (!virtcon_hds[index]) {
|
if (!virtcon_hds[index]) {
|
||||||
fprintf(stderr, "qemu: could not open virtio console '%s': %s\n",
|
fprintf(stderr, "qemu: could not connect virtio console"
|
||||||
devname, strerror(errno));
|
" to character backend '%s'\n", devname);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
qemu_opt_set(dev_opts, "chardev", label);
|
qemu_opt_set(dev_opts, "chardev", label);
|
||||||
|
Loading…
Reference in New Issue
Block a user