aboutsummaryrefslogtreecommitdiff
path: root/lib/xwrap.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/xwrap.c')
-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);
}