X-Git-Url: http://www.privoxy.org/gitweb/?a=blobdiff_plain;f=errlog.c;h=ca2a4e58445c833709cd165fd1caafd3020a4a77;hb=14ae95b35343d79502b18e635e5b9cb8efd23f13;hp=a6b477459d3c04492b2a72128d545068a195ebaf;hpb=484c53d05cfe647a9a10981ba45e9579e33dcfe8;p=privoxy.git diff --git a/errlog.c b/errlog.c index a6b47745..ca2a4e58 100644 --- a/errlog.c +++ b/errlog.c @@ -1,4 +1,4 @@ -const char errlog_rcs[] = "$Id: errlog.c,v 1.95 2009/05/28 17:07:42 fabiankeil Exp $"; +const char errlog_rcs[] = "$Id: errlog.c,v 1.98 2009/07/08 23:18:05 ler762 Exp $"; /********************************************************************* * * File : $Source: /cvsroot/ijbswa/current/errlog.c,v $ @@ -342,6 +342,21 @@ void init_error_log(const char *prog_name, const char *logfname) { fclose(logfp); } +#ifdef unix + if (!no_daemon && (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(); @@ -422,8 +437,7 @@ static inline size_t get_log_timestamp(char *buffer, size_t buffer_size) 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); @@ -574,11 +588,9 @@ static inline const char *get_log_level_string(int loglevel) log_level_string = "Force"; break; #endif /* def FEATURE_FORCE_LOAD */ -#ifdef FEATURE_FAST_REDIRECTS case LOG_LEVEL_REDIRECTS: log_level_string = "Redirect"; break; -#endif /* def FEATURE_FAST_REDIRECTS */ case LOG_LEVEL_DEANIMATE: log_level_string = "Gif-Deanimate"; break;