X-Git-Url: http://mj.ucw.cz/gitweb/?a=blobdiff_plain;ds=sidebyside;f=lib%2Flog-file.c;h=401e797c3edeca4d4e5a529bc4b0e12debb13c30;hb=dc63fe59d2bb4c3eb8be67790a55069c8c0a46a9;hp=1ef69a14456ff4a64828266ed9e220a75fa81e02;hpb=a7fc20538dc1a483eb77aa94d182f3e1f27f1ce8;p=libucw.git diff --git a/lib/log-file.c b/lib/log-file.c index 1ef69a14..401e797c 100644 --- a/lib/log-file.c +++ b/lib/log-file.c @@ -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--; @@ -70,7 +67,7 @@ internal_log_switch(struct tm *tm) } void -log_file(byte *name) +log_file(const char *name) { if (name) {