]> git.decadent.org.uk Git - nfs-utils.git/blobdiff - utils/idmapd/idmapd.c
Detect presence of nfs4_set_debug() in libnfsidmap and
[nfs-utils.git] / utils / idmapd / idmapd.c
index 5712edbded40b635e85ce53270fcb779795d2a33..c8ce6b2db54e305d6cf57aeb8541584490b44e7f 100644 (file)
@@ -345,7 +345,9 @@ main(int argc, char **argv)
                errx(1, "Could not find group \"%s\"", nobodygroup);
        nobodygid = gr->gr_gid;
 
+#ifdef HAVE_NFS4_SET_DEBUG
        nfs4_set_debug(verbose, idmapd_warnx);
+#endif
        if (conf_path == NULL)
                conf_path = _PATH_IDMAPDCONF;
        if (nfs4_init_name_mapping(conf_path))
@@ -547,9 +549,10 @@ nfsdcb(int fd, short which, void *data)
        if (which != EV_READ)
                goto out;
 
-       if ((len = read(ic->ic_fd, buf, sizeof(buf))) == -1) {
+       if ((len = read(ic->ic_fd, buf, sizeof(buf))) <= 0) {
                idmapd_warnx("nfsdcb: read(%s) failed: errno %d (%s)",
-                            ic->ic_path, errno, strerror(errno));
+                            ic->ic_path, len?errno:0, 
+                            len?strerror(errno):"End of File");
                goto out;
        }