Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/usr.sbin/makemandb Skip files of size 0 from indexing.
details: https://anonhg.NetBSD.org/src/rev/370bc8408835
branches: trunk
changeset: 791330:370bc8408835
user: wiz <wiz%NetBSD.org@localhost>
date: Wed Nov 13 18:46:33 2013 +0000
description:
Skip files of size 0 from indexing.
>From Abhinav Upadhyay <er.abhinav.upadhyay%gmail.com@localhost>.
diffstat:
usr.sbin/makemandb/makemandb.c | 20 ++++++++++++--------
1 files changed, 12 insertions(+), 8 deletions(-)
diffs (48 lines):
diff -r a08a87c0615f -r 370bc8408835 usr.sbin/makemandb/makemandb.c
--- a/usr.sbin/makemandb/makemandb.c Wed Nov 13 17:47:27 2013 +0000
+++ b/usr.sbin/makemandb/makemandb.c Wed Nov 13 18:46:33 2013 +0000
@@ -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@localhost>
* Copyright (c) 2011 Kristaps Dzonsons <kristaps%bsd.lv@localhost>
@@ -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 @@
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 @@
}
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 --
Home |
Main Index |
Thread Index |
Old Index