summaryrefslogtreecommitdiff
path: root/usr.bin/mandoc
diff options
context:
space:
mode:
authorTodd C. Miller <millert@cvs.openbsd.org>2016-05-23 18:59:01 +0000
committerTodd C. Miller <millert@cvs.openbsd.org>2016-05-23 18:59:01 +0000
commit34d9d678a2d62a55959c30256161a9420299ff6e (patch)
tree6aff1cdb8b5d3fb45aa43db31c3f723955c9d13c /usr.bin/mandoc
parentcf7a670d9f872a58664dbcb1068aa3f90ee3a358 (diff)
Trim trailing whitespace from man.conf lines. OK schwarze@.
Diffstat (limited to 'usr.bin/mandoc')
-rw-r--r--usr.bin/mandoc/manpath.c11
1 files changed, 5 insertions, 6 deletions
diff --git a/usr.bin/mandoc/manpath.c b/usr.bin/mandoc/manpath.c
index c04727c94b9..908bdd06b49 100644
--- a/usr.bin/mandoc/manpath.c
+++ b/usr.bin/mandoc/manpath.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: manpath.c,v 1.17 2015/11/07 17:58:52 schwarze Exp $ */
+/* $OpenBSD: manpath.c,v 1.18 2016/05/23 18:59:00 millert Exp $ */
/*
* Copyright (c) 2011, 2014, 2015 Ingo Schwarze <schwarze@openbsd.org>
* Copyright (c) 2011 Kristaps Dzonsons <kristaps@bsd.lv>
@@ -173,13 +173,12 @@ manconf_file(struct manconf *conf, const char *file)
while ((linelen = getline(&line, &linesz, stream)) != -1) {
cp = line;
- ep = cp + linelen;
- if (ep[-1] != '\n')
- break;
- *--ep = '\0';
+ ep = cp + linelen - 1;
+ while (ep > cp && isspace((unsigned char)*ep))
+ *ep-- = '\0';
while (isspace((unsigned char)*cp))
cp++;
- if (*cp == '#')
+ if (cp == ep || *cp == '#')
continue;
for (tok = 0; tok < sizeof(toks)/sizeof(toks[0]); tok++) {