diff options
author | 2016-05-23 18:59:00 +0000 | |
---|---|---|
committer | 2016-05-23 18:59:00 +0000 | |
commit | eff00e48ab61f4a38af9729d0ef19e58c96de6d2 (patch) | |
tree | 4bfefd76555407ca93242e4b0435d90c32001dbc /usr.bin/mandoc/manpath.c | |
parent | Add support for IPv6 (RFC 7552). (diff) | |
download | wireguard-openbsd-eff00e48ab61f4a38af9729d0ef19e58c96de6d2.tar.xz wireguard-openbsd-eff00e48ab61f4a38af9729d0ef19e58c96de6d2.zip |
Trim trailing whitespace from man.conf lines. OK schwarze@.
Diffstat (limited to 'usr.bin/mandoc/manpath.c')
-rw-r--r-- | usr.bin/mandoc/manpath.c | 11 |
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++) { |