Module Name: src Committed By: abhinav Date: Sat Dec 17 17:04:38 UTC 2016
Modified Files: src/usr.sbin/makemandb: makemandb.c Log Message: Don't ignore symlinks. There can be symlinks which are pointing to man pages not installed in one of the _default locations mentioned in man.conf or MANPATH. For example there are man pages in /usr/pkg/man which are symlinked to pages in /usr/pkg/lib/perl5/man. If we ignore symlinks, we would not be able to index such pages installed outside the default set of directories. (Also, the symlink test was incorecct, so we never noticed this issue) Ok christos@, wiz@ To generate a diff of this commit: cvs rdiff -u -r1.44 -r1.45 src/usr.sbin/makemandb/makemandb.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/usr.sbin/makemandb/makemandb.c diff -u src/usr.sbin/makemandb/makemandb.c:1.44 src/usr.sbin/makemandb/makemandb.c:1.45 --- src/usr.sbin/makemandb/makemandb.c:1.44 Mon Oct 3 16:11:11 2016 +++ src/usr.sbin/makemandb/makemandb.c Sat Dec 17 17:04:38 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: makemandb.c,v 1.44 2016/10/03 16:11:11 abhinav Exp $ */ +/* $NetBSD: makemandb.c,v 1.45 2016/12/17 17:04:38 abhinav Exp $ */ /* * Copyright (c) 2011 Abhinav Upadhyay <er.abhinav.upadh...@gmail.com> * Copyright (c) 2011 Kristaps Dzonsons <krist...@bsd.lv> @@ -17,7 +17,7 @@ */ #include <sys/cdefs.h> -__RCSID("$NetBSD: makemandb.c,v 1.44 2016/10/03 16:11:11 abhinav Exp $"); +__RCSID("$NetBSD: makemandb.c,v 1.45 2016/12/17 17:04:38 abhinav Exp $"); #include <sys/stat.h> #include <sys/types.h> @@ -526,9 +526,10 @@ traversedir(const char *parent, const ch } } closedir(dp); + return; } - if (!S_ISREG(sb.st_mode) && !S_ISLNK(sb.st_mode)) + if (!S_ISREG(sb.st_mode)) return; if (sb.st_size == 0) { @@ -820,15 +821,8 @@ update_db(sqlite3 *db, struct mparse *mp if (md5_status == 0) { /* * The MD5 hash is already present in the database, - * so simply update the metadata, ignoring symlinks. + * so simply update the metadata. */ - struct stat sb; - stat(file, &sb); - if (S_ISLNK(sb.st_mode)) { - free(md5sum); - link_count++; - continue; - } update_existing_entry(db, file, md5sum, rec, &new_count, &link_count, &err_count); free(md5sum); @@ -867,12 +861,12 @@ update_db(sqlite3 *db, struct mparse *mp } if (mflags.verbosity == 2) { - printf("Total Number of new or updated pages encountered = %d\n" - "Total number of (hard or symbolic) links found = %d\n" - "Total number of pages that were successfully" - " indexed/updated = %d\n" - "Total number of pages that could not be indexed" - " due to errors = %d\n", + printf("Number of new or updated pages encountered: %d\n" + "Number of hard links found: %d\n" + "Number of pages that were successfully" + " indexed or updated: %d\n" + "Number of pages that could not be indexed" + " due to errors: %d\n", total_count - link_count, link_count, new_count, err_count); }