]> mj.ucw.cz Git - libucw.git/blobdiff - lib/log-file.c
Merge with git+ssh://git.ucw.cz/projects/sherlock/GIT/sherlock.git#v3.11
[libucw.git] / lib / log-file.c
index 1ef69a14456ff4a64828266ed9e220a75fa81e02..401e797c3edeca4d4e5a529bc4b0e12debb13c30 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);
       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(fd);
-      close(1);
-      dup(2);
       switched = 1;
     }
   log_switch_nest--;
       switched = 1;
     }
   log_switch_nest--;
@@ -70,7 +67,7 @@ internal_log_switch(struct tm *tm)
 }
 
 void
 }
 
 void
-log_file(byte *name)
+log_file(const char *name)
 {
   if (name)
     {
 {
   if (name)
     {