diff options
author | Kay Sievers <kay.sievers@suse.de> | 2005-08-13 02:36:12 +0200 |
---|---|---|
committer | Kay Sievers <kay.sievers@suse.de> | 2005-08-13 02:36:12 +0200 |
commit | af5461f72f86bc00fd40a11a8ac2b6979f8cd61a (patch) | |
tree | fdd962e1003bc64af19c423bc3a29eb994a860d0 /udevd.c | |
parent | 7d38d2287c882ffee02b5f285f2ee5bb60de0efa (diff) |
don't fail too bad, if /dev/null does not exist
Signed-off-by: Kay Sievers <kay.sievers@suse.de>
Diffstat (limited to 'udevd.c')
-rw-r--r-- | udevd.c | 14 |
1 files changed, 7 insertions, 7 deletions
@@ -785,7 +785,7 @@ int main(int argc, char *argv[], char *envp[]) { int maxsockplus; int retval; - int fd; + int devnull; struct sigaction act; fd_set readfds; const char *value; @@ -841,12 +841,12 @@ int main(int argc, char *argv[], char *envp[]) setpriority(PRIO_PROCESS, 0, UDEVD_PRIORITY); /* Set fds to dev/null */ - fd = open( "/dev/null", O_RDWR ); - if (fd >= 0) { - dup2(fd, STDIN_FILENO); - dup2(fd, STDOUT_FILENO); - dup2(fd, STDERR_FILENO); - close(fd); + devnull = open( "/dev/null", O_RDWR ); + if (devnull > 0) { + dup2(devnull, STDIN_FILENO); + dup2(devnull, STDOUT_FILENO); + dup2(devnull, STDERR_FILENO); + close(devnull); } else err("error opening /dev/null %s", strerror(errno)); |