X-Git-Url: https://git.decadent.org.uk/gitweb/?p=nfs-utils.git;a=blobdiff_plain;f=utils%2Fidmapd%2Fidmapd.c;h=ca52c2c497a8a03ffa3f9f3ffc17a5bbf2d13944;hp=73c30b91c00e07368750823b97cd09f9b34e943e;hb=3adabc36875e73fead1b15c7c5eb8f357ad039f7;hpb=62c4197d5b41b66af58c34a4cc79c023599f0f72 diff --git a/utils/idmapd/idmapd.c b/utils/idmapd/idmapd.c index 73c30b9..ca52c2c 100644 --- a/utils/idmapd/idmapd.c +++ b/utils/idmapd/idmapd.c @@ -287,6 +287,7 @@ main(int argc, char **argv) if (stat(conf_path, &sb) == -1 && (errno == ENOENT || errno == EACCES)) { warn("Skipping configuration file \"%s\"", conf_path); + conf_path = NULL; } else { conf_init(); verbose = conf_get_num("General", "Verbosity", 0); @@ -295,7 +296,6 @@ main(int argc, char **argv) strlcpy(pipefsdir, xpipefsdir, sizeof(pipefsdir)); CONF_SAVE(nobodyuser, conf_get_str("Mapping", "Nobody-User")); CONF_SAVE(nobodygroup, conf_get_str("Mapping", "Nobody-Group")); - nfs4_init_name_mapping(conf_path); } while ((opt = getopt(argc, argv, GETOPTSTR)) != -1) @@ -337,6 +337,12 @@ main(int argc, char **argv) errx(1, "Could not find group \"%s\"", nobodygroup); nobodygid = gr->gr_gid; + nfs4_set_debug(verbose, idmapd_warnx); + if (conf_path == NULL) + conf_path = _PATH_IDMAPDCONF; + if (nfs4_init_name_mapping(conf_path)) + errx(1, "Unable to create name to user id mappings."); + if (!fg) mydaemon(0, 0); @@ -688,10 +694,10 @@ nfsdreopen_one(struct idmap_client *ic) idmapd_warnx("ReOpening %s", ic->ic_path); if ((fd = open(ic->ic_path, O_RDWR, 0)) != -1) { - if (ic->ic_fd != -1) - close(ic->ic_fd); if ((ic->ic_event.ev_flags & EVLIST_INIT)) event_del(&ic->ic_event); + if (ic->ic_fd != -1) + close(ic->ic_fd); ic->ic_event.ev_fd = ic->ic_fd = fd; event_set(&ic->ic_event, ic->ic_fd, EV_READ, nfsdcb, ic);