]> git.decadent.org.uk Git - nfs-utils.git/blobdiff - utils/idmapd/idmapd.c
Move idmapd's configuration file parsing routines into
[nfs-utils.git] / utils / idmapd / idmapd.c
index 6b5971cad526aa86e472937f8af9492fb323fb45..65a6a2a2ef413e116357d209f8bbdd2e3cdf7f2d 100644 (file)
@@ -66,7 +66,7 @@
 #endif /* HAVE_CONFIG_H */
 
 #include "xlog.h"
-#include "cfg.h"
+#include "conffile.h"
 #include "queue.h"
 #include "nfslib.h"
 
@@ -156,7 +156,7 @@ static char *nobodyuser, *nobodygroup;
 static uid_t nobodyuid;
 static gid_t nobodygid;
 
-/* Used by cfg.c */
+/* Used by conffile.c in libnfs.a */
 char *conf_path;
 
 static int
@@ -169,7 +169,10 @@ flush_nfsd_cache(char *path, time_t now)
        fd = open(path, O_RDWR);
        if (fd == -1)
                return -1;
-       write(fd, stime, strlen(stime));
+       if (write(fd, stime, strlen(stime)) != strlen(stime)) {
+               errx(1, "Flushing nfsd cache failed: errno %d (%s)",
+                       errno, strerror(errno));
+       }
        close(fd);
        return 0;
 }
@@ -342,9 +345,11 @@ main(int argc, char **argv)
                        xlog_err("main: fcntl(%s): %s", pipefsdir, strerror(errno));
 
                if (fcntl(fd, F_NOTIFY,
-                       DN_CREATE | DN_DELETE | DN_MODIFY | DN_MULTISHOT) == -1)
+                       DN_CREATE | DN_DELETE | DN_MODIFY | DN_MULTISHOT) == -1) {
                        xlog_err("main: fcntl(%s): %s", pipefsdir, strerror(errno));
-
+                       if (errno == EINVAL)
+                               xlog_err("main: Possibly no Dnotify support in kernel.");
+               }
                TAILQ_INIT(&icq);
 
                /* These events are persistent */
@@ -973,9 +978,12 @@ mydaemon(int nochdir, int noclose)
                        dup2(tempfd, 0);
                        dup2(tempfd, 1);
                        dup2(tempfd, 2);
-                       closeall(3);
-               } else
-                       closeall(0);
+                       close(tempfd);
+               } else {
+                       err(1, "mydaemon: can't open /dev/null: errno %d",
+                              errno);
+                       exit(1);
+               }
        }
 
        return;
@@ -986,7 +994,10 @@ release_parent(void)
        int status;
 
        if (pipefds[1] > 0) {
-               write(pipefds[1], &status, 1);
+               if (write(pipefds[1], &status, 1) != 1) {
+                       err(1, "Writing to parent pipe failed: errno %d (%s)\n",
+                               errno, strerror(errno));
+               }
                close(pipefds[1]);
                pipefds[1] = -1;
        }