-const char errlog_rcs[] = "$Id: errlog.c,v 1.96 2009/05/28 21:13:34 fabiankeil Exp $";
+const char errlog_rcs[] = "$Id: errlog.c,v 1.99 2009/12/26 11:34:01 fabiankeil Exp $";
/*********************************************************************
*
* File : $Source: /cvsroot/ijbswa/current/errlog.c,v $
{
fclose(logfp);
}
+#ifdef unix
+ if (daemon_mode && (logfp == stderr))
+ {
+ if (dup2(1, 2) == -1)
+ {
+ /*
+ * We only use fatal_error() to clear the pid
+ * file and to exit. Given that stderr has just
+ * been closed, the user will not see the error
+ * message.
+ */
+ fatal_error("Failed to reserve fd 2.");
+ }
+ }
+#endif
logfp = fp;
unlock_logfile();
gettimeofday(&tv_now, NULL);
msecs = tv_now.tv_usec / 1000;
-
- time(&now);
+ now = tv_now.tv_sec;
#ifdef HAVE_LOCALTIME_R
tm_now = *localtime_r(&now, &tm_now);