sbase

suckless unix tools
git clone git://git.2f30.org/sbase.git
Log | Files | Refs | README | LICENSE

commit c8af293a35ce7a622e2f350334cb94eb4e00bd8d
parent 1af5f26b3238d66d1c8ea005d84fd7a7294ec5a3
Author: FRIGN <dev@frign.de>
Date:   Sat Apr  4 23:09:06 +0200

Fix small issue in nl(1)

If fp == NULL we don't want to close it.

Diffstat:
nl.c | 4++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/nl.c b/nl.c @@ -111,7 +111,7 @@ getlinetype(char *type, regex_t *preg) int main(int argc, char *argv[]) { - FILE *fp; + FILE *fp = NULL; size_t l, s; char *d, *formattype, *formatblit; @@ -195,6 +195,6 @@ main(int argc, char *argv[]) nl(argv[0], fp); } - return !!(fshut(fp, argv[0]) + fshut(stdin, "<stdin>") + + return !!((fp && fshut(fp, argv[0])) + fshut(stdin, "<stdin>") + fshut(stdout, "<stdout>")); }