Make dialog's --prgbox option actually work.

This commit is contained in:
Nathan Whitehorn 2011-04-17 17:30:29 +00:00
parent 7a1c0d9633
commit b94209c68b
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=220750

View File

@ -33,8 +33,7 @@ dlg_popen(const char *command, const char *type)
FILE *result = 0; FILE *result = 0;
int fd[2]; int fd[2];
int pid; int pid;
char *blob; const char *argv[4];
char **argv;
if ((*type == 'r' || *type != 'w') && pipe(fd) == 0) { if ((*type == 'r' || *type != 'w') && pipe(fd) == 0) {
switch (pid = fork()) { 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 * given command. Also, it needs the command to be parsed into
* tokens. * tokens.
*/ */
if ((blob = malloc(4 + strlen(command))) != 0) { argv[0] = "sh";
sprintf(blob, "-c %s", command); argv[1] = "-c";
argv = dlg_string_to_argv(blob); argv[2] = command;
execvp("sh", argv); argv[3] = NULL;
} execvp("sh", (char **)argv);
_exit(127); _exit(127);
/* NOTREACHED */ /* NOTREACHED */
default: /* parent */ default: /* parent */