]> git.decadent.org.uk Git - nfs-utils.git/blobdiff - utils/gssd/gssd_main_loop.c
rpc.gssd: simplify signal handling
[nfs-utils.git] / utils / gssd / gssd_main_loop.c
index f1a68d3473550663bd3964aab4bdfe4c53a3e88a..9954ffb0c2a3f3c2c9ecd0158001cd4c809ade02 100644 (file)
@@ -61,8 +61,10 @@ extern int pollsize;
 
 static volatile int dir_changed = 1;
 
-static void dir_notify_handler(int sig, siginfo_t *si, void *data)
+static void dir_notify_handler(int sig)
 {
+       printerr(2, "dir_notify_handler: sig %d\n", sig);
+
        dir_changed = 1;
 }
 
@@ -76,8 +78,10 @@ scan_poll_results(int ret)
        {
                i = clp->gssd_poll_index;
                if (i >= 0 && pollarray[i].revents) {
-                       if (pollarray[i].revents & POLLHUP)
+                       if (pollarray[i].revents & POLLHUP) {
+                               clp->gssd_close_me = 1;
                                dir_changed = 1;
+                       }
                        if (pollarray[i].revents & POLLIN)
                                handle_gssd_upcall(clp);
                        pollarray[clp->gssd_poll_index].revents = 0;
@@ -87,8 +91,10 @@ scan_poll_results(int ret)
                }
                i = clp->krb5_poll_index;
                if (i >= 0 && pollarray[i].revents) {
-                       if (pollarray[i].revents & POLLHUP)
+                       if (pollarray[i].revents & POLLHUP) {
+                               clp->krb5_close_me = 1;
                                dir_changed = 1;
+                       }
                        if (pollarray[i].revents & POLLIN)
                                handle_krb5_upcall(clp);
                        pollarray[clp->krb5_poll_index].revents = 0;
@@ -96,17 +102,6 @@ scan_poll_results(int ret)
                        if (!ret)
                                break;
                }
-               i = clp->spkm3_poll_index;
-               if (i >= 0 && pollarray[i].revents) {
-                       if (pollarray[i].revents & POLLHUP)
-                               dir_changed = 1;
-                       if (pollarray[i].revents & POLLIN)
-                               handle_spkm3_upcall(clp);
-                       pollarray[clp->spkm3_poll_index].revents = 0;
-                       ret--;
-                       if (!ret)
-                               break;
-               }
        }
 };
 
@@ -188,13 +183,12 @@ void
 gssd_run()
 {
        int                     ret;
-       struct sigaction        dn_act;
+       struct sigaction        dn_act = {
+               .sa_handler = dir_notify_handler
+       };
        sigset_t                set;
 
-       /* Taken from linux/Documentation/dnotify.txt: */
-       dn_act.sa_sigaction = dir_notify_handler;
        sigemptyset(&dn_act.sa_mask);
-       dn_act.sa_flags = SA_SIGINFO;
        sigaction(DNOTIFY_SIGNAL, &dn_act, NULL);
 
        /* just in case the signal is blocked... */