mirror of
https://github.com/freebsd/freebsd-src
synced 2024-10-04 23:50:27 +00:00
comm: flush stdout for error checking prior to exiting
UNIX conformance wants utilities to catch any errors when doing I/O, as opposed to relying on the implicit flush upon exit. comm currently does not do that. This commit adds handling of I/O errors on stdout prior to exit. Reviewed by: imp, allanjude Sponsored by: Apple Inc. Differential Revision: https://reviews.freebsd.org/D45439
This commit is contained in:
parent
b5b90ff984
commit
63f5c101a1
|
@ -172,6 +172,8 @@ main(int argc, char *argv[])
|
|||
(void)printf("%s%s\n", col2, line2);
|
||||
}
|
||||
}
|
||||
if (ferror(stdout) != 0 || fflush(stdout) != 0)
|
||||
err(1, "stdout");
|
||||
exit(0);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue