summaryrefslogtreecommitdiff
path: root/usr.bin/xargs/xargs.c
diff options
context:
space:
mode:
authorTed Unangst <tedu@cvs.openbsd.org>2003-07-15 23:30:48 +0000
committerTed Unangst <tedu@cvs.openbsd.org>2003-07-15 23:30:48 +0000
commitc556cb70e0af5a0e722937f631d2cda5984d513d (patch)
treeab1d9143ef74805b5bbccb1ddf643adc3293b164 /usr.bin/xargs/xargs.c
parentf65e5bdcfff4372832c42d776c3316e4fac2dae4 (diff)
can't use err after vfork. ok millert
Diffstat (limited to 'usr.bin/xargs/xargs.c')
-rw-r--r--usr.bin/xargs/xargs.c16
1 files changed, 10 insertions, 6 deletions
diff --git a/usr.bin/xargs/xargs.c b/usr.bin/xargs/xargs.c
index d63f742aeab..551451dda25 100644
--- a/usr.bin/xargs/xargs.c
+++ b/usr.bin/xargs/xargs.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: xargs.c,v 1.16 2003/06/13 16:54:00 millert Exp $ */
+/* $OpenBSD: xargs.c,v 1.17 2003/07/15 23:30:47 tedu Exp $ */
/* $FreeBSD: xargs.c,v 1.51 2003/05/03 19:09:11 obrien Exp $ */
/*-
@@ -45,7 +45,7 @@ static const char copyright[] =
#if 0
static const char sccsid[] = "@(#)xargs.c 8.1 (Berkeley) 6/6/93";
#else
-static const char rcsid[] = "$OpenBSD: xargs.c,v 1.16 2003/06/13 16:54:00 millert Exp $";
+static const char rcsid[] = "$OpenBSD: xargs.c,v 1.17 2003/07/15 23:30:47 tedu Exp $";
#endif
#endif /* not lint */
@@ -523,14 +523,18 @@ exec:
err(1, "vfork");
case 0:
if (oflag) {
- if ((fd = open(_PATH_TTY, O_RDONLY)) == -1)
- err(1, "can't open /dev/tty");
+ if ((fd = open(_PATH_TTY, O_RDONLY)) == -1) {
+ warn("can't open /dev/tty");
+ _exit(1);
+ }
} else {
fd = open(_PATH_DEVNULL, O_RDONLY);
}
if (fd > STDIN_FILENO) {
- if (dup2(fd, STDIN_FILENO) != 0)
- err(1, "can't dup2 to stdin");
+ if (dup2(fd, STDIN_FILENO) != 0) {
+ warn("can't dup2 to stdin");
+ _exit(1);
+ }
close(fd);
}
execvp(argv[0], argv);