]> mj.ucw.cz Git - libucw.git/commitdiff
Moved detaching of stdout from log_file() to the daemon-helper.
authorMartin Mares <mj@ucw.cz>
Wed, 20 Jun 2007 08:04:08 +0000 (10:04 +0200)
committerMartin Mares <mj@ucw.cz>
Wed, 20 Jun 2007 08:04:08 +0000 (10:04 +0200)
lib/log-file.c

index 1ef69a14456ff4a64828266ed9e220a75fa81e02..f880dc1ddf9049cd62e2b9d98b1a1af3bba76d29 100644 (file)
@@ -43,11 +43,8 @@ do_log_switch(struct tm *tm)
       fd = sh_open(name, O_WRONLY | O_CREAT | O_APPEND, 0666);
       if (fd < 0)
        die("Unable to open log file %s: %m", name);
-      close(2);
-      dup(fd);
+      dup2(fd, 2);
       close(fd);
-      close(1);
-      dup(2);
       switched = 1;
     }
   log_switch_nest--;