]> arthur.barton.de Git - netatalk.git/commitdiff
Use sigaction() instead of signal() for ignoring SIGPIPE
authorFrank Lahm <franklahm@googlemail.com>
Thu, 22 Nov 2012 08:58:02 +0000 (09:58 +0100)
committerFrank Lahm <franklahm@googlemail.com>
Thu, 22 Nov 2012 08:58:02 +0000 (09:58 +0100)
Move the code to ignore SIGPIPE from the DSI sesssion setup stage
to the main signal handling code in main() and avoid the use
of deprecated signal() function and use sigaction.

etc/afpd/main.c
libatalk/dsi/dsi_getsess.c

index e89d0a2e9e58d6aacf2e2cc5af061a56959bb5dc..afbd90e059331d30183bcacbac3c09562ebbc1dc 100644 (file)
@@ -253,6 +253,13 @@ int main(int ac, char **av)
         afp_exit(EXITERR_SYS);
     }
 #endif
+
+    sv.sa_handler = SIG_IGN;
+    sigemptyset( &sv.sa_mask );
+    if (sigaction(SIGPIPE, &sv, NULL ) < 0 ) {
+        LOG(log_error, logtype_afpd, "main: sigaction: %s", strerror(errno) );
+        afp_exit(EXITERR_SYS);
+    }
     
     sv.sa_handler = afp_goaway; /* handler for all sigs */
 
index 001279cd74ae6ad717eef7fe01a7880a77b3dfab..d5b855a8c359ae904f7ad6338fe7f2b5008d3d6b 100644 (file)
@@ -121,7 +121,6 @@ int dsi_getsession(DSI *dsi, server_child *serv_children, int tickleval, afp_chi
     /* set up the tickle timer */
     dsi->timer.it_interval.tv_sec = dsi->timer.it_value.tv_sec = tickleval;
     dsi->timer.it_interval.tv_usec = dsi->timer.it_value.tv_usec = 0;
-    signal(SIGPIPE, SIG_IGN); /* we catch these ourselves */
     dsi_opensession(dsi);
     *childp = NULL;
     return 0;