]> arthur.barton.de Git - netatalk.git/blobdiff - etc/afpd/main.c
Add sigquit
[netatalk.git] / etc / afpd / main.c
index 6fa49cf4017f07919ff84e55ddc14c0d42f82049..5e4da980f62b70081ae79d938a545eac999a46cf 100644 (file)
@@ -104,28 +104,39 @@ static void fd_reset_listening_sockets(void)
             continue;
         fdset_del_fd(&fdset, &polldata, &fdset_used, &fdset_size, config->fd);
     }
-    fd_set_listening_sockets();
 }
 
 /* ------------------ */
 static void afp_goaway(int sig)
 {
+        AFPConfig *config;
 
 #ifndef NO_DDP
     asp_kill(sig);
 #endif /* ! NO_DDP */
 
-    if (server_children)
-        server_child_kill(server_children, CHILD_DSIFORK, sig);
-
     switch( sig ) {
 
     case SIGTERM :
         LOG(log_note, logtype_afpd, "AFP Server shutting down on SIGTERM");
-        AFPConfig *config;
+
+        if (server_children)
+            server_child_kill(server_children, CHILD_DSIFORK, sig);
+
+        for (config = configs; config; config = config->next)
+            if (config->server_cleanup)
+                config->server_cleanup(config);
+        server_unlock(default_options.pidfile);
+        exit(0);
+        break;
+
+    case SIGQUIT:
+        LOG(log_note, logtype_afpd, "AFP Server shutting down on SIGQUIT, NOT disconnecting clients");
+
         for (config = configs; config; config = config->next)
             if (config->server_cleanup)
                 config->server_cleanup(config);
+
         server_unlock(default_options.pidfile);
         exit(0);
         break;
@@ -134,6 +145,9 @@ static void afp_goaway(int sig)
         nologin++;
         auth_unload();
         LOG(log_info, logtype_afpd, "disallowing logins");        
+
+        if (server_children)
+            server_child_kill(server_children, CHILD_DSIFORK, sig);
         break;
 
     case SIGHUP :
@@ -229,7 +243,6 @@ int main(int ac, char **av)
     }
 
     memset(&sv, 0, sizeof(sv));    
-#ifdef AFP3x
     /* linux at least up to 2.4.22 send a SIGXFZ for vfat fs,
        even if the file is open with O_LARGEFILE ! */
 #ifdef SIGXFSZ
@@ -239,7 +252,6 @@ int main(int ac, char **av)
         LOG(log_error, logtype_afpd, "main: sigaction: %s", strerror(errno) );
         exit(EXITERR_SYS);
     }
-#endif
 #endif
     
     sv.sa_handler = child_handler;
@@ -339,6 +351,7 @@ int main(int ac, char **av)
         if (reloadconfig) {
             nologin++;
             auth_unload();
+            fd_reset_listening_sockets();
 
             LOG(log_info, logtype_afpd, "re-reading configuration file");
             for (config = configs; config; config = config->next)
@@ -352,10 +365,13 @@ int main(int ac, char **av)
                 LOG(log_error, logtype_afpd, "config re-read: no servers configured");
                 exit(EXITERR_CONF);
             }
-            fd_reset_listening_sockets();
+
+            fd_set_listening_sockets();
+
             nologin = 0;
             reloadconfig = 0;
             errno = saveerrno;
+            continue;
         }
 
         if (ret == 0)