]> mj.ucw.cz Git - libucw.git/blobdiff - lib/log.c
Yet another bug in the pattern matcher fixed.
[libucw.git] / lib / log.c
index 213987a855670b81560543ed0b9cf32c4aa81ad1..f17b8d9be616edb32066d49e489bb33ef478e22b 100644 (file)
--- a/lib/log.c
+++ b/lib/log.c
@@ -7,6 +7,7 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <stdarg.h>
+#include <fcntl.h>
 #include <unistd.h>
 #include <sys/time.h>
 
@@ -76,3 +77,17 @@ initlog(byte *argv0)
     progname = basename(argv0);
   pid = getpid();
 }
+
+void
+open_log_file(byte *name)
+{
+  if (name)
+    {
+      int fd = open(name, O_WRONLY | O_CREAT | O_APPEND, 0666);
+      if (fd < 0)
+       die("Unable to open log file");
+      close(2);
+      dup(fd);
+      close(fd);
+    }
+}