diff options
author | Ray Lai <ray@cvs.openbsd.org> | 2007-03-23 03:19:31 +0000 |
---|---|---|
committer | Ray Lai <ray@cvs.openbsd.org> | 2007-03-23 03:19:31 +0000 |
commit | 30909f2d59ae675c576c7d283843cfa39c1ed76d (patch) | |
tree | ea05b06525d1edcfa36d941032055b433b94f625 /usr.bin/sendbug/sendbug.c | |
parent | e9b2bfc8572a57b08f3d27abc0247435142c02f9 (diff) |
Support command-line arguments in $EDITOR. Prodded by deraadt@.
Diffstat (limited to 'usr.bin/sendbug/sendbug.c')
-rw-r--r-- | usr.bin/sendbug/sendbug.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/usr.bin/sendbug/sendbug.c b/usr.bin/sendbug/sendbug.c index 2b9e3bba525..c09ab513283 100644 --- a/usr.bin/sendbug/sendbug.c +++ b/usr.bin/sendbug/sendbug.c @@ -1,4 +1,4 @@ -/* $OpenBSD: sendbug.c,v 1.7 2007/03/23 03:13:22 deraadt Exp $ */ +/* $OpenBSD: sendbug.c,v 1.8 2007/03/23 03:19:30 ray Exp $ */ /* * Written by Ray Lai <ray@cyth.net>. @@ -47,7 +47,7 @@ int main(int argc, char *argv[]) { const char *editor, *tmpdir; - char *tmppath = NULL; + char *argp[] = {"sh", "-c", NULL, NULL}, *tmppath = NULL; int ch, c, fd, ret = 1; struct stat sb; time_t mtime; @@ -109,8 +109,10 @@ main(int argc, char *argv[]) warn("fork"); goto cleanup; case 0: - execlp(editor, editor, tmppath, (void *)NULL); - err(1, "execlp"); + if (asprintf(&argp[2], "%s %s", editor, tmppath) == -1) + err(1, "asprintf"); + execv(_PATH_BSHELL, argp); + err(1, "execv"); default: wait(NULL); break; |