From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from localhost (mandoc.bsd.lv [local]) by mandoc.bsd.lv (OpenSMTPD) with ESMTPA id 3bd727ad for ; Sun, 26 Jan 2020 06:17:17 -0500 (EST) Date: Sun, 26 Jan 2020 06:17:17 -0500 (EST) X-Mailinglist: mandoc-source Reply-To: source@mandoc.bsd.lv MIME-Version: 1.0 From: schwarze@mandoc.bsd.lv To: source@mandoc.bsd.lv Subject: mandoc: Fix incorrect file type tests. X-Mailer: activitymail 1.26, http://search.cpan.org/dist/activitymail/ Content-Type: text/plain; charset=utf-8 Message-ID: Log Message: ----------- Fix incorrect file type tests. This bug caused sockets and character special devices to be accepted as manual pages if they appeared inside manpaths, and it caused incorrect file names to be entered into the database when the manpath or one of its parent directories was a symbolic link. This fixes the issues reported by on ports@, but additional issues remain when symbolic links are contained in a manpath that involves another symbolic link. Modified Files: -------------- mandoc: mandocdb.c Revision Data ------------- Index: mandocdb.c =================================================================== RCS file: /home/cvs/mandoc/mandoc/mandocdb.c,v retrieving revision 1.264 retrieving revision 1.265 diff -Lmandocdb.c -Lmandocdb.c -u -p -r1.264 -r1.265 --- mandocdb.c +++ mandocdb.c @@ -801,7 +801,7 @@ filescan(const char *file) exitcode = (int)MANDOCLEVEL_BADARG; say(file, "&lstat"); return; - } else if ((st.st_mode & (S_IFREG | S_IFLNK)) == 0) { + } else if (S_ISREG(st.st_mode) == 0 && S_ISLNK(st.st_mode) == 0) { exitcode = (int)MANDOCLEVEL_BADARG; say(file, "Not a regular file"); return; @@ -840,7 +840,7 @@ filescan(const char *file) * Note the stat(2) can still fail if the link target * doesn't exist. */ - if (st.st_mode & S_IFLNK) { + if (S_ISLNK(st.st_mode)) { if (stat(buf, &st) == -1) { exitcode = (int)MANDOCLEVEL_BADARG; say(file, "&stat"); -- To unsubscribe send an email to source+unsubscribe@mandoc.bsd.lv