]> mj.ucw.cz Git - libucw.git/commitdiff
Logging: log_new_fd to fd=2 also prevents stderr from closing
authorMartin Mares <mj@ucw.cz>
Thu, 12 Feb 2015 18:06:34 +0000 (19:06 +0100)
committerMartin Mares <mj@ucw.cz>
Thu, 12 Feb 2015 18:06:34 +0000 (19:06 +0100)
ucw/log-file.c

index 40871418d7399fc92fff7b618fd9ad72f7a9004e..2e7a8d26873b306b9734877ed6d2f2497303fae6 100644 (file)
@@ -119,6 +119,8 @@ log_new_fd(int fd, uint flags)
   struct log_stream *ls = log_new_stream(sizeof(struct file_stream));
   struct file_stream *fs = (struct file_stream *) ls;
   fs->fd = fd;
+  if (fd == 2)
+    log_stderr_replaced = 1;
   fs->flags = flags;
   ls->msgfmt = LSFMT_DEFAULT;
   ls->handler = file_handler;