chiark / gitweb /
udev: don't close std{in,out,err}
authorTom Gundersen <teg@jklm.no>
Fri, 12 Sep 2014 14:22:44 +0000 (16:22 +0200)
committerTom Gundersen <teg@jklm.no>
Tue, 16 Sep 2014 10:12:56 +0000 (12:12 +0200)
Rather than printing debug output to stderr and redirecting this to /dev/null when not wanted,
use the correct log_*() function in the first place.

src/udev/udevd.c

index 8922ff9f8e3bcf134bb32a8a5214cadf09489910..e90d9dacb056fca6c374786ba3dadfa50caf09f1 100644 (file)
@@ -1221,18 +1221,6 @@ int main(int argc, char *argv[]) {
 
         log_info("starting version " VERSION "\n");
 
 
         log_info("starting version " VERSION "\n");
 
-        if (!arg_debug) {
-                int fd;
-
-                fd = open("/dev/null", O_RDWR);
-                if (fd >= 0) {
-                        dup2(fd, STDIN_FILENO);
-                        dup2(fd, STDOUT_FILENO);
-                        dup2(fd, STDERR_FILENO);
-                        close(fd);
-                }
-        }
-
         fd_inotify = udev_watch_init(udev);
         if (fd_inotify < 0) {
                 log_error("error initializing inotify");
         fd_inotify = udev_watch_init(udev);
         if (fd_inotify < 0) {
                 log_error("error initializing inotify");