nmbd and smbd had different behavior with respect to log files. nmbd would
[samba.git] / source3 / nmbd / nmbd.c
index 24f4951612c43cc277dc063a27c91dcd349b94c2..9b872f8ffe04003dbd7139e1f52456ec399ac59b 100644 (file)
@@ -61,7 +61,7 @@ extern struct in_addr ipzero;
 /**************************************************************************** **
   catch a sigterm
  **************************************************************************** */
-static int sig_term(void)
+static void sig_term(int sig)
 {
   BlockSignals(True,SIGTERM);
   
@@ -81,14 +81,12 @@ static int sig_term(void)
 
   exit(0);
 
-  /* Keep compiler happy.. */
-  return 0;
 } /* sig_term */
 
 /**************************************************************************** **
  catch a sighup
  **************************************************************************** */
-static int sig_hup(void)
+static void sig_hup(int sig)
 {
   BlockSignals( True, SIGHUP );
 
@@ -103,13 +101,12 @@ static int sig_hup(void)
 
   BlockSignals(False,SIGHUP);
 
-  return(0);
 } /* sig_hup */
 
 /**************************************************************************** **
  catch a sigpipe
  **************************************************************************** */
-static int sig_pipe(void)
+static void sig_pipe(int sig)
 {
   BlockSignals( True, SIGPIPE );
 
@@ -117,7 +114,6 @@ static int sig_pipe(void)
   if ( !is_daemon )
     exit(1);
   BlockSignals( False, SIGPIPE );
-  return(0);
 } /* sig_pipe */
 
 #if DUMP_CORE
@@ -147,7 +143,7 @@ static BOOL dump_core(void)
     rlp.rlim_cur = MAX( 4*1024*1024, rlp.rlim_cur );
     setrlimit( RLIMIT_CORE, &rlp );
     getrlimit( RLIMIT_CORE, &rlp );
-    DEBUG( 3, ( "Core limits now %d %d\n", rlp.rlim_cur, rlp.rlim_max ) );
+    DEBUG( 3, ( "Core limits now %d %d\n", (int)rlp.rlim_cur, (int)rlp.rlim_max ) );
   }
 #endif
 #endif
@@ -538,6 +534,8 @@ static void usage(char *pname)
   printf( "\t-n netbiosname.       " );
   printf( "the netbios name to advertise for this host\n");
   printf( "\t-H hosts file         load a netbios hosts file\n" );
+  printf( "\t-a                    append to log file (default)\n" );
+  printf( "\t-o                    overwrite log file, don't append\n" );
   printf( "\n");
 } /* usage */
 
@@ -550,6 +548,9 @@ int main(int argc,char *argv[])
   int opt;
   extern FILE *dbf;
   extern char *optarg;
+  extern BOOL  append_log;
+
+  append_log = True;  /* Default, override with '-o' option. */
 
   global_nmb_port = NMB_PORT;
   *host_file = 0;
@@ -599,7 +600,8 @@ int main(int argc,char *argv[])
 #endif /* SIGUSR2 */
 #endif /* MEM_MAN */
 
-  while((opt = getopt(argc, argv, "as:T:I:C:bAi:B:N:Rn:l:d:Dp:hSH:G:f:")) != EOF)
+  while( EOF != 
+         (opt = getopt( argc, argv, "aos:T:I:C:bAi:B:N:Rn:l:d:Dp:hSH:G:f:" )) )
     {
       switch (opt)
         {
@@ -628,10 +630,10 @@ int main(int argc,char *argv[])
           strupper(scope);
           break;
         case 'a':
-          {
-          extern BOOL append_log;
-          append_log = !append_log;
-          }
+          append_log = True;
+          break;
+        case 'o':
+          append_log = False;
           break;
         case 'D':
           is_daemon = True;