Merge of max log file fixes from appliance:
authorTim Potter <tpot@samba.org>
Thu, 23 Jan 2003 03:02:08 +0000 (03:02 +0000)
committerTim Potter <tpot@samba.org>
Thu, 23 Jan 2003 03:02:08 +0000 (03:02 +0000)
 - smbd/process.c: check log file sizes more often than in
       timeout_processing()

 - lib/debug.c: increment debug_count inside Debug1() instead of
       when log file sizes are checked.

source/lib/debug.c
source/smbd/process.c

index 2efdd3c2a3cdcc0f517caf2f2dcd3171e7070503..83a470872a0b8964d47b8af5815e231f96115dbc 100644 (file)
@@ -625,7 +625,7 @@ BOOL need_to_check_log_size( void )
 {
        int maxlog;
 
-       if( debug_count++ < 100 )
+       if( debug_count < 100 )
                return( False );
 
        maxlog = lp_max_log_size() * 1024;
@@ -710,6 +710,8 @@ void check_log_size( void )
   va_list ap;  
   int old_errno = errno;
 
+  debug_count++;
+
   if( stdout_logging )
     {
     va_start( ap, format_str );
index ff84dc8e1a679b284d71c4098a97f563bebb2b90..2b92b9910fc4789cbcd4dcb68a3369c673f646e6 100644 (file)
@@ -1314,5 +1314,17 @@ void smbd_process(void)
                                last_timeout_processing_time = new_check_time; /* Reset time. */
                        }
                }
+
+               /* The timeout_processing function isn't run nearly
+                  often enough to implement 'max log size' without
+                  overrunning the size of the file by many megabytes.
+                  This is especially true if we are running at debug
+                  level 10.  Checking every 50 SMBs is a nice
+                  tradeoff of performance vs log file size overrun. */
+
+               if ((num_smbs % 50) == 0 && need_to_check_log_size()) {
+                       change_to_root_user();
+                       check_log_size();
+               }
        }
 }