Mon Mar 5 19:16:27 2012 UTC ()
Pull up the following revisions(s) (requested by joerg in ticket #77):
	usr.sbin/makemandb/makemandb.c:	revision 1.7

Fix inverted condition when handling stale entries.


(sborrill)
diff -r1.2.2.2 -r1.2.2.3 src/usr.sbin/makemandb/makemandb.c

cvs diff -r1.2.2.2 -r1.2.2.3 src/usr.sbin/makemandb/makemandb.c (expand / switch to unified diff)

--- src/usr.sbin/makemandb/makemandb.c 2012/03/02 17:02:00 1.2.2.2
+++ src/usr.sbin/makemandb/makemandb.c 2012/03/05 19:16:27 1.2.2.3
@@ -1,33 +1,33 @@ @@ -1,33 +1,33 @@
1/* $NetBSD: makemandb.c,v 1.2.2.2 2012/03/02 17:02:00 riz Exp $ */ 1/* $NetBSD: makemandb.c,v 1.2.2.3 2012/03/05 19:16:27 sborrill Exp $ */
2/* 2/*
3 * Copyright (c) 2011 Abhinav Upadhyay <er.abhinav.upadhyay@gmail.com> 3 * Copyright (c) 2011 Abhinav Upadhyay <er.abhinav.upadhyay@gmail.com>
4 * Copyright (c) 2011 Kristaps Dzonsons <kristaps@bsd.lv> 4 * Copyright (c) 2011 Kristaps Dzonsons <kristaps@bsd.lv>
5 * 5 *
6 * Permission to use, copy, modify, and distribute this software for any 6 * Permission to use, copy, modify, and distribute this software for any
7 * purpose with or without fee is hereby granted, provided that the above 7 * purpose with or without fee is hereby granted, provided that the above
8 * copyright notice and this permission notice appear in all copies. 8 * copyright notice and this permission notice appear in all copies.
9 * 9 *
10 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 10 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
11 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 11 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
12 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 12 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
13 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 13 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
14 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 14 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
15 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 15 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
16 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 16 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
17 */ 17 */
18 18
19#include <sys/cdefs.h> 19#include <sys/cdefs.h>
20__RCSID("$NetBSD: makemandb.c,v 1.2.2.2 2012/03/02 17:02:00 riz Exp $"); 20__RCSID("$NetBSD: makemandb.c,v 1.2.2.3 2012/03/05 19:16:27 sborrill Exp $");
21 21
22#include <sys/stat.h> 22#include <sys/stat.h>
23#include <sys/types.h> 23#include <sys/types.h>
24 24
25#include <assert.h> 25#include <assert.h>
26#include <ctype.h> 26#include <ctype.h>
27#include <dirent.h> 27#include <dirent.h>
28#include <err.h> 28#include <err.h>
29#include <archive.h> 29#include <archive.h>
30#include <libgen.h> 30#include <libgen.h>
31#include <md5.h> 31#include <md5.h>
32#include <stdio.h> 32#include <stdio.h>
33#include <stdlib.h> 33#include <stdlib.h>
@@ -762,27 +762,27 @@ update_db(sqlite3 *db, struct mparse *mp @@ -762,27 +762,27 @@ update_db(sqlite3 *db, struct mparse *mp
762 762
763 sqlite3_finalize(stmt); 763 sqlite3_finalize(stmt);
764  764
765 if (mflags.verbosity) { 765 if (mflags.verbosity) {
766 printf("Total Number of new or updated pages enountered = %d\n" 766 printf("Total Number of new or updated pages enountered = %d\n"
767 "Total number of pages that were successfully" 767 "Total number of pages that were successfully"
768 " indexed/updated = %d\n" 768 " indexed/updated = %d\n"
769 "Total number of (hard or symbolic) links found = %d\n" 769 "Total number of (hard or symbolic) links found = %d\n"
770 "Total number of pages that could not be indexed" 770 "Total number of pages that could not be indexed"
771 " due to errors = %d\n", 771 " due to errors = %d\n",
772 total_count, new_count, link_count, err_count); 772 total_count, new_count, link_count, err_count);
773 } 773 }
774 774
775 if (mflags.recreate == 0) 775 if (mflags.recreate)
776 return; 776 return;
777 777
778 if (mflags.verbosity) 778 if (mflags.verbosity)
779 printf("Deleting stale index entries\n"); 779 printf("Deleting stale index entries\n");
780 780
781 sqlstr = "DELETE FROM mandb_meta WHERE file NOT IN" 781 sqlstr = "DELETE FROM mandb_meta WHERE file NOT IN"
782 " (SELECT file FROM metadb.file_cache);" 782 " (SELECT file FROM metadb.file_cache);"
783 "DROP TABLE metadb.file_cache;" 783 "DROP TABLE metadb.file_cache;"
784 "DELETE FROM mandb WHERE rowid NOT IN" 784 "DELETE FROM mandb WHERE rowid NOT IN"
785 " (SELECT id FROM mandb_meta);"; 785 " (SELECT id FROM mandb_meta);";
786 786
787 sqlite3_exec(db, sqlstr, NULL, NULL, &errmsg); 787 sqlite3_exec(db, sqlstr, NULL, NULL, &errmsg);
788 if (errmsg != NULL) { 788 if (errmsg != NULL) {