Module Name: src Committed By: wiz Date: Wed Nov 13 18:46:33 UTC 2013
Modified Files: src/usr.sbin/makemandb: makemandb.c Log Message: Skip files of size 0 from indexing. >From Abhinav Upadhyay <er.abhinav.upadh...@gmail.com>. To generate a diff of this commit: cvs rdiff -u -r1.19 -r1.20 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.19 src/usr.sbin/makemandb/makemandb.c:1.20 --- src/usr.sbin/makemandb/makemandb.c:1.19 Wed May 15 00:35:02 2013 +++ src/usr.sbin/makemandb/makemandb.c Wed Nov 13 18:46:33 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: makemandb.c,v 1.19 2013/05/15 00:35:02 christos Exp $ */ +/* $NetBSD: makemandb.c,v 1.20 2013/11/13 18:46:33 wiz 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.19 2013/05/15 00:35:02 christos Exp $"); +__RCSID("$NetBSD: makemandb.c,v 1.20 2013/11/13 18:46:33 wiz Exp $"); #include <sys/stat.h> #include <sys/types.h> @@ -469,12 +469,6 @@ traversedir(const char *parent, const ch return; } - /* If it is a regular file or a symlink, pass it to build_cache() */ - if (S_ISREG(sb.st_mode) || S_ISLNK(sb.st_mode)) { - build_file_cache(db, parent, file, &sb); - return; - } - /* If it is a directory, traverse it recursively */ if (S_ISDIR(sb.st_mode)) { if ((dp = opendir(file)) == NULL) { @@ -493,6 +487,16 @@ traversedir(const char *parent, const ch } closedir(dp); } + + if (!S_ISREG(sb.st_mode) && !S_ISLNK(sb.st_mode)) + return; + + if (sb.st_size == 0) { + if (mflags.verbosity) + warnx("Empty file: %s", file); + return; + } + build_file_cache(db, parent, file, &sb); } /* build_file_cache --