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 r55KREO6031857 for ; Wed, 5 Jun 2013 16:27:14 -0400 (EDT) Received: (from schwarze@localhost) by krisdoz.my.domain (8.14.5/8.14.3/Submit) id r55KRBmj025860; Wed, 5 Jun 2013 16:27:11 -0400 (EDT) Date: Wed, 5 Jun 2013 16:27:11 -0400 (EDT) Message-Id: <201306052027.r55KRBmj025860@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: Two sanity checks got lost in treescan() during the switch from X-Mailer: activitymail 1.26, http://search.cpan.org/dist/activitymail/ Content-Type: text/plain; charset=utf-8 Log Message: ----------- Two sanity checks got lost in treescan() during the switch from db to sqlite; restore these: * Warn and skip when directory and file name mismatch. * Warn and skip when finding special files. * Warning about "mandocdb.db" is useless, it is always present. * While here, do not hardcode "mandocdb.db", use MANDOC_DB. 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.59 retrieving revision 1.60 diff -Lmandocdb.c -Lmandocdb.c -u -p -r1.59 -r1.60 --- mandocdb.c +++ mandocdb.c @@ -567,6 +567,8 @@ treescan(void) * Disallow duplicate (hard-linked) files. */ if (FTS_F == ff->fts_info) { + if (0 == strcmp(path, MANDOC_DB)) + continue; if ( ! use_all && ff->fts_level < 2) { if (warnings) say(path, "Extraneous file"); @@ -575,45 +577,50 @@ treescan(void) if (warnings) say(path, "Duplicate file"); continue; - } - - cp = ff->fts_name; - - if (0 == strcmp(cp, "mandocdb.db")) { - if (warnings) - say(path, "Skip database"); - continue; - } else if (NULL != (cp = strrchr(cp, '.'))) { - if (0 == strcmp(cp + 1, "html")) { - if (warnings) - say(path, "Skip html"); - continue; - } else if (0 == strcmp(cp + 1, "gz")) { + } else if (NULL == (sec = + strrchr(ff->fts_name, '.'))) { + if ( ! use_all) { if (warnings) - say(path, "Skip gz"); - continue; - } else if (0 == strcmp(cp + 1, "ps")) { - if (warnings) - say(path, "Skip ps"); - continue; - } else if (0 == strcmp(cp + 1, "pdf")) { - if (warnings) - say(path, "Skip pdf"); + say(path, + "No filename suffix"); continue; } - } - - if (NULL != (sec = strrchr(ff->fts_name, '.'))) { - *sec = '\0'; - sec = stradd(sec + 1); + } else if (0 == strcmp(++sec, "html")) { + if (warnings) + say(path, "Skip html"); + continue; + } else if (0 == strcmp(sec, "gz")) { + if (warnings) + say(path, "Skip gz"); + continue; + } else if (0 == strcmp(sec, "ps")) { + if (warnings) + say(path, "Skip ps"); + continue; + } else if (0 == strcmp(sec, "pdf")) { + if (warnings) + say(path, "Skip pdf"); + continue; + } else if ( ! use_all && + ((FORM_SRC == dform && strcmp(sec, dsec)) || + (FORM_CAT == dform && strcmp(sec, "0")))) { + if (warnings) + say(path, "Wrong filename suffix"); + continue; + } else { + sec[-1] = '\0'; + sec = stradd(sec); } name = stradd(ff->fts_name); ofadd(dform, path, name, dsec, sec, arch, ff->fts_statp); continue; } else if (FTS_D != ff->fts_info && - FTS_DP != ff->fts_info) + FTS_DP != ff->fts_info) { + if (warnings) + say(path, "Not a regular file"); continue; + } switch (ff->fts_level) { case (0): -- To unsubscribe send an email to source+unsubscribe@mdocml.bsd.lv