aboutsummaryrefslogtreecommitdiff
path: root/nscd/dbg_log.c
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2004-02-17 05:16:49 +0000
committerUlrich Drepper <drepper@redhat.com>2004-02-17 05:16:49 +0000
commitf40473668438eaba88eced8d4e78db1225e90542 (patch)
treec8a55e212d39c880faba7fd1295ad9b4fdb0d6c3 /nscd/dbg_log.c
parentf04b9a68febb179fc90095ae4f9fb2b7ec68a901 (diff)
downloadglibc-f40473668438eaba88eced8d4e78db1225e90542.tar
glibc-f40473668438eaba88eced8d4e78db1225e90542.tar.gz
glibc-f40473668438eaba88eced8d4e78db1225e90542.tar.bz2
glibc-f40473668438eaba88eced8d4e78db1225e90542.zip
[BZ #18]
Update. * nscd/nscd_conf.c (nscd_parse_file): Little optimization. 2004-02-14 Thorsten Kukuk <kukuk@suse.de> * 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 <drepper@redhat.com> ld.so.preload is not present [BZ #18].
Diffstat (limited to 'nscd/dbg_log.c')
-rw-r--r--nscd/dbg_log.c20
1 files changed, 16 insertions, 4 deletions
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 <kukuk@vt.uni-paderborn.de>, 1998.
@@ -19,6 +19,7 @@
#include <stdarg.h>
#include <stdio.h>
+#include <string.h>
#include <syslog.h>
#include <unistd.h>
#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