mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-06 01:03:55 -06:00
Improve error reporting on file access
By making the error reporting include strerror(errno), it gives the user a bit more indication as to why qemu failed. This is particularly important for people running qemu as a non root user. Signed-off-by: Justin M. Forbes <jforbes@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
This commit is contained in:
parent
6c098407ef
commit
850810d01b
2 changed files with 16 additions and 16 deletions
20
vl.c
20
vl.c
|
@ -2328,8 +2328,8 @@ DriveInfo *drive_init(QemuOpts *opts, void *opaque,
|
|||
}
|
||||
|
||||
if (bdrv_open2(dinfo->bdrv, file, bdrv_flags, drv) < 0) {
|
||||
fprintf(stderr, "qemu: could not open disk image %s\n",
|
||||
file);
|
||||
fprintf(stderr, "qemu: could not open disk image %s: %s\n",
|
||||
file, strerror(errno));
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
@ -5566,7 +5566,7 @@ int main(int argc, char **argv, char **envp)
|
|||
if (len != 1)
|
||||
exit(1);
|
||||
else if (status == 1) {
|
||||
fprintf(stderr, "Could not acquire pidfile\n");
|
||||
fprintf(stderr, "Could not acquire pidfile: %s\n", strerror(errno));
|
||||
exit(1);
|
||||
} else
|
||||
exit(0);
|
||||
|
@ -5593,7 +5593,7 @@ int main(int argc, char **argv, char **envp)
|
|||
uint8_t status = 1;
|
||||
write(fds[1], &status, 1);
|
||||
} else
|
||||
fprintf(stderr, "Could not acquire pid file\n");
|
||||
fprintf(stderr, "Could not acquire pid file: %s\n", strerror(errno));
|
||||
exit(1);
|
||||
}
|
||||
#endif
|
||||
|
@ -5777,8 +5777,8 @@ int main(int argc, char **argv, char **envp)
|
|||
snprintf(label, sizeof(label), "serial%d", i);
|
||||
serial_hds[i] = qemu_chr_open(label, devname, NULL);
|
||||
if (!serial_hds[i]) {
|
||||
fprintf(stderr, "qemu: could not open serial device '%s'\n",
|
||||
devname);
|
||||
fprintf(stderr, "qemu: could not open serial device '%s': %s\n",
|
||||
devname, strerror(errno));
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
@ -5791,8 +5791,8 @@ int main(int argc, char **argv, char **envp)
|
|||
snprintf(label, sizeof(label), "parallel%d", i);
|
||||
parallel_hds[i] = qemu_chr_open(label, devname, NULL);
|
||||
if (!parallel_hds[i]) {
|
||||
fprintf(stderr, "qemu: could not open parallel device '%s'\n",
|
||||
devname);
|
||||
fprintf(stderr, "qemu: could not open parallel device '%s': %s\n",
|
||||
devname, strerror(errno));
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
@ -5805,8 +5805,8 @@ int main(int argc, char **argv, char **envp)
|
|||
snprintf(label, sizeof(label), "virtcon%d", i);
|
||||
virtcon_hds[i] = qemu_chr_open(label, devname, NULL);
|
||||
if (!virtcon_hds[i]) {
|
||||
fprintf(stderr, "qemu: could not open virtio console '%s'\n",
|
||||
devname);
|
||||
fprintf(stderr, "qemu: could not open virtio console '%s': %s\n",
|
||||
devname, strerror(errno));
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue