Date: Sun, 17 Apr 2011 17:30:29 +0000 (UTC) From: Nathan Whitehorn <nwhitehorn@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r220750 - head/contrib/dialog Message-ID: <201104171730.p3HHUTll044799@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: nwhitehorn Date: Sun Apr 17 17:30:29 2011 New Revision: 220750 URL: http://svn.freebsd.org/changeset/base/220750 Log: Make dialog's --prgbox option actually work. Modified: head/contrib/dialog/prgbox.c Modified: head/contrib/dialog/prgbox.c ============================================================================== --- head/contrib/dialog/prgbox.c Sun Apr 17 17:28:17 2011 (r220749) +++ head/contrib/dialog/prgbox.c Sun Apr 17 17:30:29 2011 (r220750) @@ -33,8 +33,7 @@ dlg_popen(const char *command, const cha 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 cha * 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 */
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201104171730.p3HHUTll044799>