mirror of
https://github.com/openbsd/src.git
synced 2024-12-22 16:42:56 -08:00
can't use err after vfork. ok millert
This commit is contained in:
parent
c72ea322cc
commit
87fdc3ff45
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user