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

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;