Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/usr.bin/man If the default path doesn't result in a match, b...
details: https://anonhg.NetBSD.org/src/rev/a426d8dad673
branches: trunk
changeset: 772425:a426d8dad673
user: joerg <joerg%NetBSD.org@localhost>
date: Tue Jan 03 17:49:57 2012 +0000
description:
If the default path doesn't result in a match, bail out early instead of
running into a segmentation fault. Based on patch by Abhinav Upadhyay.
diffstat:
usr.bin/man/man.c | 12 +++++++++---
1 files changed, 9 insertions(+), 3 deletions(-)
diffs (33 lines):
diff -r 31a6452a2978 -r a426d8dad673 usr.bin/man/man.c
--- a/usr.bin/man/man.c Tue Jan 03 15:44:00 2012 +0000
+++ b/usr.bin/man/man.c Tue Jan 03 17:49:57 2012 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: man.c,v 1.43 2011/06/14 20:08:45 wiz Exp $ */
+/* $NetBSD: man.c,v 1.44 2012/01/03 17:49:57 joerg Exp $ */
/*
* Copyright (c) 1987, 1993, 1994, 1995
@@ -40,7 +40,7 @@
#if 0
static char sccsid[] = "@(#)man.c 8.17 (Berkeley) 1/31/95";
#else
-__RCSID("$NetBSD: man.c,v 1.43 2011/06/14 20:08:45 wiz Exp $");
+__RCSID("$NetBSD: man.c,v 1.44 2012/01/03 17:49:57 joerg Exp $");
#endif
#endif /* not lint */
@@ -1021,7 +1021,13 @@
if (glob(defaultpath, GLOB_BRACE | GLOB_NOSORT, NULL, &pg) != 0)
err(EXIT_FAILURE, "glob failed");
-
+
+ if (pg.gl_matchc == 0) {
+ warnx("Default path in %s doesn't exist", _PATH_MANCONF);
+ globfree(&pg);
+ return;
+ }
+
TAILQ_FOREACH(esubd, &subdirs->entrylist, q) {
/* Drop cat page directory, only sources are relevant. */
if (strncmp(esubd->s, "man", 3))
Home |
Main Index |
Thread Index |
Old Index