diff options
| author | wiz <wiz@NetBSD.org> | 2013-11-13 18:46:33 +0000 |
|---|---|---|
| committer | wiz <wiz@NetBSD.org> | 2013-11-13 18:46:33 +0000 |
| commit | 22e7d185114ebb623e18a446f5b4e91b744076af (patch) | |
| tree | 14a981738db71c022d4095f29a673301e031f585 /usr.sbin/makemandb/makemandb.c | |
| parent | 0677bc21432faa25110a79bc6284108b13a63d19 (diff) | |
Skip files of size 0 from indexing.
From Abhinav Upadhyay <er.abhinav.upadhyay@gmail.com>.
Diffstat (limited to 'usr.sbin/makemandb/makemandb.c')
| -rw-r--r-- | usr.sbin/makemandb/makemandb.c | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/usr.sbin/makemandb/makemandb.c b/usr.sbin/makemandb/makemandb.c index df9823211dd..ba159e24469 100644 --- a/usr.sbin/makemandb/makemandb.c +++ b/usr.sbin/makemandb/makemandb.c @@ -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.upadhyay@gmail.com> * Copyright (c) 2011 Kristaps Dzonsons <kristaps@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 char *file, sqlite3 *db, 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 char *file, sqlite3 *db, } 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 -- |
