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].
2004-02-16 Ulrich Drepper <drepper@redhat.com>
+ * 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>
+
* elf/rtld.c (dl_main): Don't fail execution if file named in
- ld.so.preload is not present.
+ ld.so.preload is not present [BZ #18].
* sysdeps/posix/getaddrinfo.c (getaddrinfo): Undo unintended
changes in last patch.
-/* 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.
#include <stdarg.h>
#include <stdio.h>
+#include <string.h>
#include <syslog.h>
#include <unistd.h>
#include "dbg_log.h"
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
-/* 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.
extern void dbg_log (const char *str, ...)
__attribute__ ((__format__ (__printf__, 1, 2)));;
-extern int set_logfile (const char *logfile);
+extern void set_logfile (const char *logfile);
+extern int init_logfile (void);
#endif
if (write_pid (_PATH_NSCDPID) < 0)
dbg_log ("%s: %s", _PATH_NSCDPID, strerror (errno));
+ if (!init_logfile ())
+ dbg_log (_("Could not create log file"));
+
/* Ignore job control signals. */
signal (SIGTTOU, SIG_IGN);
signal (SIGTTIN, SIG_IGN);
-/* Copyright (c) 1998, 2000, 2003 Free Software Foundation, Inc.
+/* Copyright (c) 1998, 2000, 2003, 2004 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Thorsten Kukuk <kukuk@suse.de>, 1998.
if (fp == NULL)
return -1;
+ /* The stream is not used by more than one thread. */
+ (void) __fsetlocking (fp, FSETLOCKING_BYCALLER);
+
line = NULL;
len = 0;
dbg_log ("server %s is not supported\n", arg1);
}
else if (strcmp (entry, "logfile") == 0)
- {
- if (!set_logfile (arg1))
- dbg_log (_("Could not create log file \"%s\""), arg1);
- }
+ set_logfile (arg1);
else if (strcmp (entry, "debug-level") == 0)
{
int level = atoi (arg1);
else
dbg_log (_("Unknown option: %s %s %s"), entry, arg1, arg2);
}
- while (!feof (fp));
+ while (!feof_unlocked (fp));
/* Free the buffer. */
free (line);