From fdfdda53b96f5c44d173d7f6d4bf59fe67c7ef30 Mon Sep 17 00:00:00 2001 From: phantom Date: Tue, 28 Dec 1999 12:55:58 +0000 Subject: Better handling groff failures. If popen(ROFF_COMMAND) returns zero bytes then handle it as problem. This commit fixes problem with archiving empty files. PR: gnu/5767 Submitted by: Bill Fenner --- gnu/usr.bin/man/man/man.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'gnu') diff --git a/gnu/usr.bin/man/man/man.c b/gnu/usr.bin/man/man/man.c index 8120134..cd62990 100644 --- a/gnu/usr.bin/man/man/man.c +++ b/gnu/usr.bin/man/man/man.c @@ -1254,10 +1254,12 @@ make_cat_file (path, man_file, cat_file, manid) } #endif - while ((s = getc(pp)) != EOF) - putc(s, fp); + f = 0; + while ((s = getc(pp)) != EOF) { + putc(s, fp); f++; + } - if ((s = pclose(pp)) == -1) { + if (!f || ((s = pclose(pp)) == -1)) { s = errno; fprintf(stderr, "Failed.\n"); errno = s; -- cgit v1.1