]> git.decadent.org.uk Git - nfs-utils.git/blobdiff - utils/gssd/gssd_main_loop.c
rpc.gssd: handle error to open toplevel directory
[nfs-utils.git] / utils / gssd / gssd_main_loop.c
index 9954ffb0c2a3f3c2c9ecd0158001cd4c809ade02..142c8c53eab6e1927f00c938dd69c723061e4cde 100644 (file)
@@ -61,10 +61,8 @@ extern int pollsize;
 
 static volatile int dir_changed = 1;
 
-static void dir_notify_handler(int sig)
+static void dir_notify_handler(__attribute__((unused))int sig)
 {
-       printerr(2, "dir_notify_handler: sig %d\n", sig);
-
        dir_changed = 1;
 }
 
@@ -123,11 +121,13 @@ topdirs_add_entry(struct dirent *dent)
        }
        snprintf(tdi->dirname, PATH_MAX, "%s/%s", pipefs_dir, dent->d_name);
        tdi->fd = open(tdi->dirname, O_RDONLY);
-       if (tdi->fd != -1) {
-               fcntl(tdi->fd, F_SETSIG, DNOTIFY_SIGNAL);
-               fcntl(tdi->fd, F_NOTIFY,
-                     DN_CREATE|DN_DELETE|DN_MODIFY|DN_MULTISHOT);
+       if (tdi->fd == -1) {
+               printerr(0, "ERROR: failed to open %s\n", tdi->dirname);
+               free(tdi);
+               return -1;
        }
+       fcntl(tdi->fd, F_SETSIG, DNOTIFY_SIGNAL);
+       fcntl(tdi->fd, F_NOTIFY, DN_CREATE|DN_DELETE|DN_MODIFY|DN_MULTISHOT);
 
        TAILQ_INSERT_HEAD(&topdirs_list, tdi, list);
        return 0;