From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from krisdoz.my.domain (schwarze@localhost [127.0.0.1]) by krisdoz.my.domain (8.14.5/8.14.5) with ESMTP id s89JZPJP016951 for ; Tue, 9 Sep 2014 15:35:25 -0400 (EDT) Received: (from schwarze@localhost) by krisdoz.my.domain (8.14.5/8.14.3/Submit) id s89JZPAY015481; Tue, 9 Sep 2014 15:35:25 -0400 (EDT) Date: Tue, 9 Sep 2014 15:35:25 -0400 (EDT) Message-Id: <201409091935.s89JZPAY015481@krisdoz.my.domain> X-Mailinglist: mdocml-source Reply-To: source@mdocml.bsd.lv MIME-Version: 1.0 From: schwarze@mdocml.bsd.lv To: source@mdocml.bsd.lv Subject: mdocml: If a manpath directory (for example, a _whatdb entry from X-Mailer: activitymail 1.26, http://search.cpan.org/dist/activitymail/ Content-Type: text/plain; charset=utf-8 Log Message: ----------- If a manpath directory (for example, a _whatdb entry from man.conf(5) or an entry in the MANPATH environment variable) does not exist, silently skip it. This brings makewhatis(8) back closer to the behaviour of espie@'s version and ought to shut up the weekly(8) whining observed by henning@ on machines not having xbase installed. Also, don't error out after the first unusable manpath entry, still try the others. Of course, still complain about non-existent directories specified on the command line and about any directories failing for other reasons than ENOENT. Modified Files: -------------- mdocml: mandocdb.c Revision Data ------------- Index: mandocdb.c =================================================================== RCS file: /usr/vhosts/mdocml.bsd.lv/cvs/mdocml/mandocdb.c,v retrieving revision 1.164 retrieving revision 1.165 diff -Lmandocdb.c -Lmandocdb.c -u -p -r1.164 -r1.165 --- mandocdb.c +++ mandocdb.c @@ -169,7 +169,7 @@ static void putmdockey(const struct mpa const struct mdoc_node *, uint64_t); static void render_key(struct mchars *, struct str *); static void say(const char *, const char *, ...); -static int set_basedir(const char *); +static int set_basedir(const char *, int); static int treescan(void); static size_t utf8(unsigned int, char [7]); @@ -436,7 +436,7 @@ main(int argc, char *argv[]) * Most of these deal with a specific directory. * Jump into that directory first. */ - if (OP_TEST != op && 0 == set_basedir(path_arg)) + if (OP_TEST != op && 0 == set_basedir(path_arg, 1)) goto out; if (dbopen(1)) { @@ -502,12 +502,12 @@ main(int argc, char *argv[]) ohash_init(&mlinks, 6, &mlinks_info); } - if (0 == set_basedir(dirs.paths[j])) - goto out; + if (0 == set_basedir(dirs.paths[j], argc > 0)) + continue; if (0 == treescan()) - goto out; + continue; if (0 == dbopen(0)) - goto out; + continue; mpages_merge(mc, mp); if (warnings && !nodb && @@ -2343,7 +2343,7 @@ hash_free(void *p, void *arg) } static int -set_basedir(const char *targetdir) +set_basedir(const char *targetdir, int report_baddir) { static char startdir[PATH_MAX]; static int getcwd_status; /* 1 = ok, 2 = failure */ @@ -2396,12 +2396,16 @@ set_basedir(const char *targetdir) * we can reliably check whether files are inside. */ if (NULL == realpath(targetdir, basedir)) { - exitcode = (int)MANDOCLEVEL_BADARG; - say("", "&%s: realpath", targetdir); + if (report_baddir || errno != ENOENT) { + exitcode = (int)MANDOCLEVEL_BADARG; + say("", "&%s: realpath", targetdir); + } return(0); } else if (-1 == chdir(basedir)) { - exitcode = (int)MANDOCLEVEL_BADARG; - say("", "&chdir"); + if (report_baddir || errno != ENOENT) { + exitcode = (int)MANDOCLEVEL_BADARG; + say("", "&chdir"); + } return(0); } chdir_status = 1; -- To unsubscribe send an email to source+unsubscribe@mdocml.bsd.lv