]> git.decadent.org.uk Git - nfs-utils.git/commitdiff
rpc.gssd: handle error to open toplevel directory
authorJ. Bruce Fields <bfields@redhat.com>
Mon, 6 Aug 2012 12:57:19 +0000 (08:57 -0400)
committerSteve Dickson <steved@redhat.com>
Mon, 6 Aug 2012 13:11:27 +0000 (09:11 -0400)
From: "J. Bruce Fields" <bfields@redhat.com>

Reverse the sense of the test here, and also add debugging and cleanup
in the error case.

(Though the lack of cleanup isn't currently a problem in practice since
we'll eventually exit in this case.)

Signed-off-by: J. Bruce Fields <bfields@redhat.com>
Signed-off-by: Steve Dickson <steved@redhat.com>
utils/gssd/gssd_main_loop.c

index 6914687344028214d3bbf2e4c4c3676622e68eae..142c8c53eab6e1927f00c938dd69c723061e4cde 100644 (file)
@@ -121,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;