From f40473668438eaba88eced8d4e78db1225e90542 Mon Sep 17 00:00:00 2001 From: Ulrich Drepper Date: Tue, 17 Feb 2004 05:16:49 +0000 Subject: [BZ #18] Update. * nscd/nscd_conf.c (nscd_parse_file): Little optimization. 2004-02-14 Thorsten Kukuk * nscd/dbg_log.c (set_logfile): Only save name of logfile, don't open it. (init_logfile): New function, open logfile if requested. * nscd/dbg_log.h: Adjust protoype for set_logfile, add init_logfile. * nscd/nscd.c (main): Call init_logfile after forking in background. * nscd/nscd_conf.c (nscd_parse_file): Adjust for new set_logfile. 2004-02-16 Ulrich Drepper ld.so.preload is not present [BZ #18]. --- nscd/dbg_log.c | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) (limited to 'nscd/dbg_log.c') diff --git a/nscd/dbg_log.c b/nscd/dbg_log.c index b854170428..bcd9426020 100644 --- a/nscd/dbg_log.c +++ b/nscd/dbg_log.c @@ -1,4 +1,4 @@ -/* Copyright (c) 1998, 2000 Free Software Foundation, Inc. +/* Copyright (c) 1998, 2000, 2004 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Thorsten Kukuk , 1998. @@ -19,6 +19,7 @@ #include #include +#include #include #include #include "dbg_log.h" @@ -28,14 +29,25 @@ if in debug mode and no debug file, we write the messages to stderr, else to syslog. */ +static char *logfilename; FILE *dbgout; int debug_level; -int +void set_logfile (const char *logfile) { - dbgout = fopen (logfile, "a"); - return dbgout == NULL ? 0 : 1; + logfilename = strdup (logfile); +} + +int +init_logfile (void) +{ + if (logfilename) + { + dbgout = fopen (logfilename, "a"); + return dbgout == NULL ? 0 : 1; + } + return 1; } void -- cgit v1.2.1