summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIngo Schwarze <schwarze@cvs.openbsd.org>2014-04-03 21:45:28 +0000
committerIngo Schwarze <schwarze@cvs.openbsd.org>2014-04-03 21:45:28 +0000
commit42823bdcab4ebac8561b1f47e9efab23ce2c76a9 (patch)
tree8bc9241c98dd915e3e54a35534503ba68ee5358c
parent9b7c8f2825fe96bbbc28e5db0bd593ed3aaaf333 (diff)
Instead of silently doing nothing at all,
warn and return non-zero when the manpath is empty, that is, when /etc/man.conf is non-existent or unreadable AND the environment variable MANPATH is unset or empty AND no directories were given on the command line. Inspired by the error handling in espie@'s makewhatis(8), except that one doesn't know about MANPATH.
-rw-r--r--usr.bin/mandoc/mandocdb.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/usr.bin/mandoc/mandocdb.c b/usr.bin/mandoc/mandocdb.c
index 1313372f435..d8ca01205ae 100644
--- a/usr.bin/mandoc/mandocdb.c
+++ b/usr.bin/mandoc/mandocdb.c
@@ -1,4 +1,4 @@
-/* $Id: mandocdb.c,v 1.83 2014/04/03 16:26:53 schwarze Exp $ */
+/* $Id: mandocdb.c,v 1.84 2014/04/03 21:45:27 schwarze Exp $ */
/*
* Copyright (c) 2011, 2012 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2011, 2012, 2013, 2014 Ingo Schwarze <schwarze@openbsd.org>
@@ -454,6 +454,11 @@ mandocdb(int argc, char *argv[])
} else
manpath_parse(&dirs, path_arg, NULL, NULL);
+ if (0 == dirs.sz) {
+ exitcode = (int)MANDOCLEVEL_BADARG;
+ say("", "Empty manpath");
+ }
+
/*
* First scan the tree rooted at a base directory, then
* build a new database and finally move it into place.