aboutgitcodebugslistschat
diff options
context:
space:
mode:
authorStefano Brivio <sbrivio@redhat.com>2021-05-10 14:00:30 +0200
committerStefano Brivio <sbrivio@redhat.com>2021-05-10 14:00:30 +0200
commitf98e3589b407fcf4dc632f958f51b1245b0b0dcc (patch)
tree828f6817aa22bab27942e11c97aa90795fcb905d
parent0328e2a1f7d452bb33e6125552f15c0a049a1016 (diff)
downloadpasst-f98e3589b407fcf4dc632f958f51b1245b0b0dcc.tar
passt-f98e3589b407fcf4dc632f958f51b1245b0b0dcc.tar.gz
passt-f98e3589b407fcf4dc632f958f51b1245b0b0dcc.tar.bz2
passt-f98e3589b407fcf4dc632f958f51b1245b0b0dcc.tar.lz
passt-f98e3589b407fcf4dc632f958f51b1245b0b0dcc.tar.xz
passt-f98e3589b407fcf4dc632f958f51b1245b0b0dcc.tar.zst
passt-f98e3589b407fcf4dc632f958f51b1245b0b0dcc.zip
qrap: Fix qemu name-guessing loop, add /usr/libexec/qemu-kvm as full path too
The name-guessing loop should iterate over names, not single characters. Also add /usr/libexec/qemu-kvm as full path for execvp(): execvp() won't find it if it's not in $PATH, which is the reason why it shouldn't be under /usr/libexec/, but this seems to be the case for some current version of Fedora. Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
-rw-r--r--qrap.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/qrap.c b/qrap.c
index 7f27d47..afb14a5 100644
--- a/qrap.c
+++ b/qrap.c
@@ -33,6 +33,7 @@ static char *qemu_names[] = {
#ifdef ARCH
"qemu-system-" ARCH,
#endif
+ "/usr/libexec/qemu-kvm",
NULL,
};
@@ -135,11 +136,11 @@ valid_args:
close(s);
if (qemu_argc) {
- char *name;
+ char **name;
- for (name = qemu_names[0]; name; name++) {
- qemu_argv[0] = name;
- execvp(name, qemu_argv);
+ for (name = qemu_names; *name; name++) {
+ qemu_argv[0] = *name;
+ execvp(*name, qemu_argv);
if (errno != ENOENT) {
perror("execvp");
usage(argv[0]);