summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--meta/recipes-devtools/qemu/qemu-helper/qemu-oe-bridge-helper.c15
1 files changed, 4 insertions, 11 deletions
diff --git a/meta/recipes-devtools/qemu/qemu-helper/qemu-oe-bridge-helper.c b/meta/recipes-devtools/qemu/qemu-helper/qemu-oe-bridge-helper.c
index cadf2a012a..9434e1d269 100644
--- a/meta/recipes-devtools/qemu/qemu-helper/qemu-oe-bridge-helper.c
+++ b/meta/recipes-devtools/qemu/qemu-helper/qemu-oe-bridge-helper.c
@@ -8,6 +8,7 @@
8 8
9#include <stdio.h> 9#include <stdio.h>
10#include <unistd.h> 10#include <unistd.h>
11#include <stdlib.h>
11 12
12void try_program(char const* path, char** args) { 13void try_program(char const* path, char** args) {
13 if (access(path, X_OK) == 0) { 14 if (access(path, X_OK) == 0) {
@@ -18,22 +19,14 @@ void try_program(char const* path, char** args) {
18int main(int argc, char** argv) { 19int main(int argc, char** argv) {
19 char* var; 20 char* var;
20 21
21 /* Copy arguments so that they are a NULL terminated list, skipping argv[0]
22 * since it is this program name */
23 char** args = malloc(argc * sizeof(char*));
24 for (int i = 0; i < argc - 1; i++) {
25 args[i] = argv[i + 1];
26 }
27 args[argc - 1] = NULL;
28
29 var = getenv("QEMU_BRIDGE_HELPER"); 22 var = getenv("QEMU_BRIDGE_HELPER");
30 if (var && var[0] != '\0') { 23 if (var && var[0] != '\0') {
31 execvp(var, args); 24 execvp(var, argv);
32 return 1; 25 return 1;
33 } 26 }
34 27
35 try_program("/usr/libexec/qemu-bridge-helper", args); 28 try_program("/usr/libexec/qemu-bridge-helper", argv);
36 try_program("/usr/lib/qemu/qemu-bridge-helper", args); 29 try_program("/usr/lib/qemu/qemu-bridge-helper", argv);
37 30
38 fprintf(stderr, "No bridge helper found\n"); 31 fprintf(stderr, "No bridge helper found\n");
39 return 1; 32 return 1;