1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-12-03 09:00:21 +00:00

When -o isn't specified, open /dev/null as stdin.

Suggested by:	jhb
This commit is contained in:
Maxime Henrion 2003-03-28 16:22:54 +00:00
parent a54ec1d233
commit cec1ba8c9c
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=112746

View File

@ -526,10 +526,13 @@ run(char **argv)
case -1:
err(1, "vfork");
case 0:
close(0);
if (oflag) {
close(0);
if (open("/dev/tty", O_RDONLY) == -1)
err(1, "open");
err(1, "open /dev/tty");
} else {
if (open("/dev/null", O_RDONLY) == -1)
err(1, "open /dev/null");
}
execvp(argv[0], argv);
childerr = errno;