aboutsummaryrefslogtreecommitdiff
path: root/main.c
diff options
context:
space:
mode:
authorRob Landley <rob@landley.net>2012-12-23 01:25:27 -0600
committerRob Landley <rob@landley.net>2012-12-23 01:25:27 -0600
commita48e5792bb26f95c18055f58d602ac279ebd4002 (patch)
tree5519ec0a32b300f142358613edcef9bc2c24ea24 /main.c
parenta8f3bf04aee8f1c6716a420719af57cd6c5a7caa (diff)
downloadtoybox-a48e5792bb26f95c18055f58d602ac279ebd4002.tar.gz
Elie De Brauwer pointed out that xputs() isn't reliably reporting errors because there's no flush. Rather than change the output granularity, flush before exit and check errors there. (We still need xputc() doing it so "yes" doesn't continue forever.)
Diffstat (limited to 'main.c')
-rw-r--r--main.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/main.c b/main.c
index 829b787a..0cd1cb23 100644
--- a/main.c
+++ b/main.c
@@ -102,6 +102,7 @@ void toy_exec(char *argv[])
if (!which) return;
toy_init(which, argv);
toys.which->toy_main();
+ if (fflush(NULL) || ferror(stdout)) perror_exit("write");
exit(toys.exitval);
}