diff options
author | nwhitehorn <nwhitehorn@FreeBSD.org> | 2011-04-17 17:30:29 +0000 |
---|---|---|
committer | nwhitehorn <nwhitehorn@FreeBSD.org> | 2011-04-17 17:30:29 +0000 |
commit | 25689fa4045c3729e6662c96d23d76b95eafcbfc (patch) | |
tree | 967cee67da93575a4f76c775d1664ec7bc25ce70 /contrib/dialog | |
parent | 471ee1c85a9d20520815f2294ff60f4a68b1961f (diff) | |
download | FreeBSD-src-25689fa4045c3729e6662c96d23d76b95eafcbfc.zip FreeBSD-src-25689fa4045c3729e6662c96d23d76b95eafcbfc.tar.gz |
Make dialog's --prgbox option actually work.
Diffstat (limited to 'contrib/dialog')
-rw-r--r-- | contrib/dialog/prgbox.c | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/contrib/dialog/prgbox.c b/contrib/dialog/prgbox.c index fea2393..8c9f627 100644 --- a/contrib/dialog/prgbox.c +++ b/contrib/dialog/prgbox.c @@ -33,8 +33,7 @@ dlg_popen(const char *command, const char *type) FILE *result = 0; int fd[2]; int pid; - char *blob; - char **argv; + const char *argv[4]; if ((*type == 'r' || *type != 'w') && pipe(fd) == 0) { switch (pid = fork()) { @@ -63,11 +62,11 @@ dlg_popen(const char *command, const char *type) * given command. Also, it needs the command to be parsed into * tokens. */ - if ((blob = malloc(4 + strlen(command))) != 0) { - sprintf(blob, "-c %s", command); - argv = dlg_string_to_argv(blob); - execvp("sh", argv); - } + argv[0] = "sh"; + argv[1] = "-c"; + argv[2] = command; + argv[3] = NULL; + execvp("sh", (char **)argv); _exit(127); /* NOTREACHED */ default: /* parent */ |