summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJ. Bruce Fields <bfields@redhat.com>2012-08-06 08:57:19 -0400
committerSteve Dickson <steved@redhat.com>2012-08-06 09:11:27 -0400
commite4e5dadd7685415059173e438a5710a9e51ffbff (patch)
treebc8e52f69d60374bd277baff253043f10a367cfe
parentd9f51f267e459c975833ac853ce41809ca492ab0 (diff)
downloadnfs-utils-e4e5dadd7685415059173e438a5710a9e51ffbff.zip
nfs-utils-e4e5dadd7685415059173e438a5710a9e51ffbff.tar.gz
nfs-utils-e4e5dadd7685415059173e438a5710a9e51ffbff.tar.xz
rpc.gssd: handle error to open toplevel directory
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>
-rw-r--r--utils/gssd/gssd_main_loop.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/utils/gssd/gssd_main_loop.c b/utils/gssd/gssd_main_loop.c
index 6914687..142c8c5 100644
--- a/utils/gssd/gssd_main_loop.c
+++ b/utils/gssd/gssd_main_loop.c
@@ -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;