This diff uses void for ffclose() when return values are not needed. Additionally, Instead of ignoring the output it also returns error codes when fclose() fails in ffclose().
Lastly, an error is shown in case of write problems instead of silently completing. Index: file.c =================================================================== RCS file: /cvs/src/usr.bin/mg/file.c,v retrieving revision 1.75 diff -u -r1.75 file.c --- file.c 23 Jan 2011 00:45:03 -0000 1.75 +++ file.c 31 Jul 2011 14:34:28 -0000 @@ -414,7 +414,7 @@ } endoffile: /* ignore errors */ - ffclose(NULL); + (void)ffclose(NULL); /* don't zap an error */ if (s == FIOEOF) { if (nline == 1) @@ -635,9 +635,11 @@ s = ffclose(bp); if (s == FIOSUC) ewprintf("Wrote %s", fn); - } else - /* ignore close error if it is a write error */ + } else { + /* print a message indicating write error */ (void)ffclose(bp); + ewprintf("Unable to write %s", fn); + } (void)fupdstat(bp); return (s == FIOSUC); } Index: fileio.c =================================================================== RCS file: /cvs/src/usr.bin/mg/fileio.c,v retrieving revision 1.84 diff -u -r1.84 fileio.c --- fileio.c 21 Jan 2011 19:10:13 -0000 1.84 +++ fileio.c 31 Jul 2011 14:34:28 -0000 @@ -77,7 +77,7 @@ return (FIOERR); } ffstat(bp); - ffclose(bp); + (void)ffclose(bp); return (FIOSUC); } @@ -128,8 +128,12 @@ int ffclose(struct buffer *bp) { - (void) fclose(ffp); - return (FIOSUC); + int ret; + ret = fclose(ffp); + if (ret == 0) + return (FIOSUC); + else + return ret; } /*