diff options
author | 2014-04-03 21:45:27 +0000 | |
---|---|---|
committer | 2014-04-03 21:45:27 +0000 | |
commit | 60ebc352e0b5ae14891792e7d9da9b3d5700deff (patch) | |
tree | c04901248a6beebbdcb2527c3ef31098409c4610 /usr.bin/mandoc/mandocdb.c | |
parent | add a uvm_yield function and use it in the reaper path to prevent the (diff) | |
download | wireguard-openbsd-60ebc352e0b5ae14891792e7d9da9b3d5700deff.tar.xz wireguard-openbsd-60ebc352e0b5ae14891792e7d9da9b3d5700deff.zip |
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.
Diffstat (limited to 'usr.bin/mandoc/mandocdb.c')
-rw-r--r-- | usr.bin/mandoc/mandocdb.c | 7 |
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. |