Simplify return & fshut() logic
Get rid of the !!()-constructs and use ret where available (or introduce it). In some cases, there would be an "abort" on the first fshut-error, but we want to close all files and report all warnings and then quit, not just the warning for the first file.
This commit is contained in:
5
sponge.c
5
sponge.c
@@ -14,6 +14,7 @@ int
|
||||
main(int argc, char *argv[])
|
||||
{
|
||||
FILE *fp, *tmpfp;
|
||||
int ret = 0;
|
||||
|
||||
argv0 = argv[0], argc--, argv++;
|
||||
|
||||
@@ -29,5 +30,7 @@ main(int argc, char *argv[])
|
||||
eprintf("fopen %s:", argv[0]);
|
||||
concat(tmpfp, "<tmpfile>", fp, argv[0]);
|
||||
|
||||
return !!(fshut(fp, argv[0]) + fshut(tmpfp, "<tmpfile>"));
|
||||
ret |= fshut(fp, argv[0]) | fshut(tmpfp, "<tmpfile>");
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
Reference in New Issue
Block a user