From 81633064dd196c40541ecece8def51745f514646 Mon Sep 17 00:00:00 2001 From: Andrew Bartlett Date: Fri, 8 Nov 2002 23:05:34 +0000 Subject: [PATCH] Compleatly remove support for logfile truncation. All logs are opened for append writes. (blessed by jra) Andrew Bartlett --- source/lib/debug.c | 13 ++----------- source/nmbd/nmbd.c | 5 ----- source/nsswitch/winbindd.c | 6 ------ source/smbd/server.c | 3 --- source/wrepld/server.c | 11 ----------- 5 files changed, 2 insertions(+), 36 deletions(-) diff --git a/source/lib/debug.c b/source/lib/debug.c index 483db71b852..f2a362bb860 100644 --- a/source/lib/debug.c +++ b/source/lib/debug.c @@ -74,15 +74,12 @@ * * dbf - Global debug file handle. * debugf - Debug file name. - * append_log - If True, then the output file will be opened in append - * mode. * DEBUGLEVEL - System-wide debug message limit. Messages with message- * levels higher than DEBUGLEVEL will not be processed. */ XFILE *dbf = NULL; pstring debugf = ""; -BOOL append_log = False; BOOL debug_warn_unknown_class = True; BOOL debug_auto_add_unknown_class = True; BOOL AllowDebugChange = True; @@ -576,10 +573,7 @@ BOOL reopen_logs( void ) } pstrcpy( debugf, fname ); - if (append_log) - new_dbf = x_fopen( debugf, O_WRONLY|O_APPEND|O_CREAT, 0644); - else - new_dbf = x_fopen( debugf, O_WRONLY|O_CREAT|O_TRUNC, 0644 ); + new_dbf = x_fopen( debugf, O_WRONLY|O_APPEND|O_CREAT, 0644); if (!new_dbf) { log_overflow = True; @@ -731,10 +725,7 @@ void check_log_size( void ) { mode_t oldumask = umask( 022 ); - if( append_log ) - dbf = x_fopen( debugf, O_WRONLY|O_APPEND|O_CREAT, 0644 ); - else - dbf = x_fopen( debugf, O_WRONLY|O_CREAT|O_TRUNC, 0644 ); + dbf = x_fopen( debugf, O_WRONLY|O_APPEND|O_CREAT, 0644 ); (void)umask( oldumask ); if( dbf ) { diff --git a/source/nmbd/nmbd.c b/source/nmbd/nmbd.c index 9f4a934fae8..50730d40f35 100644 --- a/source/nmbd/nmbd.c +++ b/source/nmbd/nmbd.c @@ -661,15 +661,12 @@ static BOOL init_structs(void) **************************************************************************** */ int main(int argc, const char *argv[]) { - extern BOOL append_log; static BOOL opt_interactive = False; poptContext pc; struct poptOption long_options[] = { POPT_AUTOHELP {"daemon", 'D', POPT_ARG_VAL, &is_daemon, True, "Become a daemon(default)" }, - {"log-append", 'a', POPT_ARG_VAL, &append_log, True, "Append to log file" }, {"interactive", 'i', POPT_ARG_VAL, &opt_interactive, True, "Run interactive (not a daemon)" }, - {"log-overwrite", 'o', POPT_ARG_VAL, &append_log, False, "Overwrite log file, don't append" }, {"hosts", 'H', POPT_ARG_STRING, dyn_LMHOSTSFILE, 'H', "Load a netbios hosts file"}, {"port", 'p', POPT_ARG_INT, &global_nmb_port, NMB_PORT, "Listen on the specified port" }, {NULL, 0, POPT_ARG_INCLUDE_TABLE, popt_common_debug }, @@ -683,8 +680,6 @@ static BOOL init_structs(void) int opt; pstring logfile; - append_log = True; /* Default, override with '-o' option. */ - global_nmb_port = NMB_PORT; global_in_nmbd = True; diff --git a/source/nsswitch/winbindd.c b/source/nsswitch/winbindd.c index 059d2f40d3e..2bd6d7967c2 100644 --- a/source/nsswitch/winbindd.c +++ b/source/nsswitch/winbindd.c @@ -746,7 +746,6 @@ static void usage(void) extern BOOL AllowDebugChange; extern pstring global_myname; extern fstring global_myworkgroup; - extern BOOL append_log; pstring logfile; BOOL interactive = False; int opt; @@ -759,11 +758,6 @@ static void usage(void) fault_setup((void (*)(void *))fault_quit ); - /* Append to log file by default as we are a single process daemon - program. */ - - append_log = True; - snprintf(logfile, sizeof(logfile), "%s/log.winbindd", dyn_LOGFILEBASE); lp_set_logfile(logfile); diff --git a/source/smbd/server.c b/source/smbd/server.c index 1272fb1569e..3d9a4675b2b 100644 --- a/source/smbd/server.c +++ b/source/smbd/server.c @@ -622,7 +622,6 @@ static void init_structs(void ) static BOOL is_daemon = False; static BOOL interactive = False; static char *ports = NULL; - extern BOOL append_log; int opt; poptContext pc; @@ -640,8 +639,6 @@ static void init_structs(void ) { NULL } }; - append_log = True; - #ifdef HAVE_SET_AUTH_PARAMETERS set_auth_parameters(argc,argv); #endif diff --git a/source/wrepld/server.c b/source/wrepld/server.c index 14d3e730f47..f08674afbb2 100644 --- a/source/wrepld/server.c +++ b/source/wrepld/server.c @@ -541,7 +541,6 @@ static void process(void) ****************************************************************************/ int main(int argc,char *argv[]) { - extern BOOL append_log; extern char *optarg; /* shall I run as a daemon */ BOOL is_daemon = False; @@ -576,18 +575,10 @@ static void process(void) lp_set_logfile(logfile); break; - case 'a': - append_log = True; - break; - case 'i': interactive = True; break; - case 'o': - append_log = False; - break; - case 'D': is_daemon = True; break; @@ -628,8 +619,6 @@ static void process(void) load_case_tables(); - append_log = True; - if(!specified_logfile) { slprintf(logfile, sizeof(logfile)-1, "%s/log.wrepld", dyn_LOGFILEBASE); -- 2.34.1