From aad492fd87d689c443e87561c23abc2e12b785a9 Mon Sep 17 00:00:00 2001 From: Rob Landley Date: Sat, 3 Jan 2015 16:25:36 -0600 Subject: Move fflush() checking to xexit() and have exit paths in main() call that. --- lib/xwrap.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'lib/xwrap.c') diff --git a/lib/xwrap.c b/lib/xwrap.c index d7030653..de7ae832 100644 --- a/lib/xwrap.c +++ b/lib/xwrap.c @@ -30,6 +30,8 @@ void xstrncat(char *dest, char *src, size_t size) void xexit(void) { + if (fflush(NULL) || ferror(stdout)) + if (!toys.exitval) perror_msg("write"); if (toys.rebound) longjmp(*toys.rebound, 1); else exit(toys.exitval); } -- cgit v1.2.3