X-Git-Url: https://git.gag.com/?a=blobdiff_plain;f=gzip.c;h=3b8de4d9af28fc3d559b99c1f4021e4e38e77113;hb=3557cd57906915eb9c990b5f386e25c395592643;hp=d66530a70bdce1d19a2687658e9ef0b9f19a1e18;hpb=a420fbafe812f9584f4e71cf3bd42f222bae74c8;p=debian%2Fgzip diff --git a/gzip.c b/gzip.c index d66530a..3b8de4d 100644 --- a/gzip.c +++ b/gzip.c @@ -664,14 +664,16 @@ int main (int argc, char **argv) } else { /* Standard input */ treat_stdin(); } - if (list && !quiet && file_count > 1) { - do_list(-1, -1); /* print totals */ - } - if (to_stdout - && ((synchronous - && (fdatasync (STDOUT_FILENO) != 0 && errno != EINVAL)) - || close (STDOUT_FILENO) != 0) - && errno != EBADF) + if (list) + { + /* Output any totals, and check for output errors. */ + if (!quiet && 1 < file_count) + do_list (-1, -1); + if (fflush (stdout) != 0) + write_error (); + } + if (to_stdout && synchronous && fdatasync (STDOUT_FILENO) != 0 + && errno != EINVAL && errno != EBADF) write_error (); do_exit(exit_code); return exit_code; /* just to avoid lint warning */