aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorRob Landley <rob@landley.net>2015-01-03 16:25:36 -0600
committerRob Landley <rob@landley.net>2015-01-03 16:25:36 -0600
commitaad492fd87d689c443e87561c23abc2e12b785a9 (patch)
tree6b3f91834fecc081f0aaffd1e3d3a2e6d90fafcd /lib
parent87fd25f20b86731dd01332ce828424e7047ef29d (diff)
downloadtoybox-aad492fd87d689c443e87561c23abc2e12b785a9.tar.gz
Move fflush() checking to xexit() and have exit paths in main() call that.
Diffstat (limited to 'lib')
-rw-r--r--lib/xwrap.c2
1 files changed, 2 insertions, 0 deletions
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);
}