When -o isn't specified, open /dev/null as stdin.
Suggested by: jhb
This commit is contained in:
parent
a54ec1d233
commit
cec1ba8c9c
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user