]> mj.ucw.cz Git - libucw.git/blobdiff - lib/log-file.c
Merge with git+ssh://git.ucw.cz/projects/sherlock/GIT/sherlock.git
[libucw.git] / lib / log-file.c
index 7fc58392572eef64865c5d65b5cc25fcac7d6124..20dea918c80ae13813913ecd05f58a7b4d99971d 100644 (file)
@@ -8,9 +8,9 @@
  */
 
 #include "lib/lib.h"
+#include "lib/lfs.h"
 
 #include <stdio.h>
-#include <stdlib.h>
 #include <string.h>
 #include <fcntl.h>
 #include <unistd.h>
@@ -38,7 +38,7 @@ do_log_switch(struct tm *tm)
   if (strcmp(name, log_filename))
     {
       strcpy(log_filename, name);
-      fd = open(name, O_WRONLY | O_CREAT | O_APPEND, 0666);
+      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);
@@ -85,8 +85,6 @@ log_file(byte *name)
       log_filename[0] = 0;
       log_switch();
       log_switch_hook = internal_log_switch;
-      close(0);
-      open("/dev/null", O_RDWR, 0);
     }
 }