Ignore:
Timestamp:
May 23, 2008, 6:56:41 AM (17 years ago)
Author:
Paul Smedley
Message:

Update source to 3.0.29

Location:
branches/samba-3.0/source/nmbd
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/samba-3.0/source/nmbd/nmbd.c

    r124 r134  
    158158        static time_t lastt;
    159159        int n;
     160        bool print_waiting_msg = true;
    160161        struct subnet_record *subrec;
    161162
     
    168169                return;
    169170        }
     171
     172  try_again:
    170173
    171174        /* the list of probed interfaces has changed, we may need to add/remove
    172175           some subnets */
    173176        load_interfaces();
    174 
    175   try_again:
    176177
    177178        /* find any interfaces that need adding */
     
    234235        /* We need to wait if there are no subnets... */
    235236        if (FIRST_SUBNET == NULL) {
    236                 void (*saved_handler)(int);
    237 
    238                 DEBUG(0,("reload_interfaces: "
    239                         "No subnets to listen to. Waiting..\n"));
     237
     238                if (print_waiting_msg) {
     239                        DEBUG(0,("reload_interfaces: "
     240                                "No subnets to listen to. Waiting..\n"));
     241                        print_waiting_msg = false;
     242                }
    240243
    241244                /*
     
    244247                 */
    245248
    246                 saved_handler = CatchSignal( SIGTERM, SIGNAL_CAST SIG_DFL );
    247 
    248                 while (iface_count() == 0) {
     249                BlockSignals(false, SIGTERM);
     250
     251                while (iface_count() == 0 && !got_sig_term) {
    249252                        sleep(5);
    250253                        load_interfaces();
     
    252255
    253256                /*
    254                  * We got an interface, restore our normal term handler.
    255                  */
    256 
    257                 CatchSignal( SIGTERM, SIGNAL_CAST saved_handler );
     257                 * Handle termination inband.
     258                 */
     259
     260                if (got_sig_term) {
     261                        got_sig_term = 0;
     262                        terminate();
     263                }
     264
     265                /*
     266                 * We got an interface, go back to blocking term.
     267                 */
     268
     269                BlockSignals(true, SIGTERM);
    258270                goto try_again;
    259271        }
  • branches/samba-3.0/source/nmbd/nmbd_subnetdb.c

    r44 r134  
    181181BOOL create_subnets(void)
    182182{   
    183         int num_interfaces = iface_count();
     183        int num_interfaces;
    184184        int i;
    185185        struct in_addr unicast_ip, ipzero;
    186186
    187         if(num_interfaces == 0) {
    188                 void (*saved_handler)(int);
    189 
     187  try_interfaces_again:
     188
     189        if (iface_count() == 0) {
    190190                DEBUG(0,("create_subnets: No local interfaces !\n"));
    191191                DEBUG(0,("create_subnets: Waiting for an interface to appear ...\n"));
     192        }
     193
     194        while (iface_count() == 0) {
     195                void (*saved_handler)(int);
    192196
    193197                /*
     
    198202                saved_handler = CatchSignal( SIGTERM, SIGNAL_CAST SIG_DFL );
    199203
    200                 while (iface_count() == 0) {
    201                         sleep(5);
    202                         load_interfaces();
    203                 }
     204                sleep(5);
     205                load_interfaces();
    204206
    205207                /*
     
    242244        /* We must have at least one subnet. */
    243245        if (subnetlist == NULL) {
    244                 DEBUG(0,("create_subnets: unable to create any subnet from "
    245                                 "given interfaces. nmbd is terminating\n"));
    246                 return False;
     246                void (*saved_handler)(int);
     247
     248                DEBUG(0,("create_subnets: Unable to create any subnet from "
     249                                "given interfaces. Is your interface line in "
     250                                "smb.conf correct ?\n"));
     251
     252                saved_handler = CatchSignal( SIGTERM, SIGNAL_CAST SIG_DFL );
     253
     254                sleep(5);
     255                load_interfaces();
     256
     257                CatchSignal( SIGTERM, SIGNAL_CAST saved_handler );
     258                goto try_interfaces_again;
    247259        }
    248260
Note: See TracChangeset for help on using the changeset viewer.