do_background: Use O_RDWR when opening the file '/dev/null'

for replacement standard streams.
This commit is contained in:
Andrew V. Samoilov 2004-08-17 20:01:58 +00:00
parent ff6051511f
commit 6776c2cdb9
1 changed files with 1 additions and 1 deletions

View File

@ -132,7 +132,7 @@ do_background (struct FileOpContext *ctx, char *info)
close (1);
close (2);
if ((nullfd = open ("/dev/null", O_RDONLY)) != -1) {
if ((nullfd = open ("/dev/null", O_RDWR)) != -1) {
while (dup2 (nullfd, 0) == -1 && errno == EINTR);
while (dup2 (nullfd, 1) == -1 && errno == EINTR);
while (dup2 (nullfd, 2) == -1 && errno == EINTR);