From 9971dd3529c07022231fd722cb593f6609dd9d70 Mon Sep 17 00:00:00 2001 From: Matthieu Herrb Date: Mon, 26 Jul 2004 22:44:25 +0000 Subject: Fix opening of log file with '-user nobody'. Problem reported by Oleg Safiullin and Mike Pechkin. --- difs/main.c | 2 +- os/error.c | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/difs/main.c b/difs/main.c index b7d8a4c..370005e 100644 --- a/difs/main.c +++ b/difs/main.c @@ -95,7 +95,6 @@ main(int argc, char *argv[]) /* init stuff */ ProcessCmdLine(argc, argv); - InitErrors(); /* * Do this first thing, to get any options that only take effect at @@ -104,6 +103,7 @@ main(int argc, char *argv[]) if (ReadConfigFile(configfilename) != FSSuccess) { FatalError("couldn't read config file\n"); } + InitErrors(); /* make sure at least world write access is disabled */ if (((oldumask = umask(022)) & 002) == 002) diff --git a/os/error.c b/os/error.c index 3d21b10..8c72a65 100644 --- a/os/error.c +++ b/os/error.c @@ -86,6 +86,7 @@ Bool UseSyslog; Bool log_open = FALSE; #endif char ErrorFile[PATH_MAX]; +static char CurrentErrorFile[PATH_MAX]; static void abort_server(void) @@ -112,7 +113,7 @@ InitErrors(void) } #endif - if (ErrorFile[0]) { + if (ErrorFile[0] && strcmp(CurrentErrorFile, ErrorFile) != 0) { i = creat(ErrorFile, 0666); if (i != -1) { dup2(i, 2); @@ -120,6 +121,7 @@ InitErrors(void) } else { ErrorF("can't open error file \"%s\"\n", ErrorFile); } + strncpy(CurrentErrorFile, ErrorFile, sizeof CurrentErrorFile); } } -- cgit v1.2.3