]> mj.ucw.cz Git - libucw.git/commitdiff
When logging to a file, redirect fd1 to the log file as well.
authorMartin Mares <mj@ucw.cz>
Fri, 16 Apr 2004 15:32:56 +0000 (15:32 +0000)
committerMartin Mares <mj@ucw.cz>
Fri, 16 Apr 2004 15:32:56 +0000 (15:32 +0000)
lib/log.c

index 381f7257830c453e32b5a28b83cffaae15fdc75b..c2f3e6ff100f09225bf7a9b9dbcba816fea7ca70 100644 (file)
--- a/lib/log.c
+++ b/lib/log.c
@@ -54,6 +54,8 @@ log_switch(struct tm *tm)
       close(2);
       dup(fd);
       close(fd);
+      close(1);
+      dup(2);
     }
   log_switching--;
 }
@@ -188,5 +190,7 @@ log_file(byte *name)
       log_name = xmalloc(log_name_size);
       log_name[0] = 0;
       log_switch(tm);
+      close(0);
+      open("/dev/null", O_RDWR, 0);
     }
 }