Elie De Brauwer pointed out that xputs() isn't reliably reporting errors because...
authorRob Landley <rob@landley.net>
Sun, 23 Dec 2012 07:25:27 +0000 (01:25 -0600)
committerRob Landley <rob@landley.net>
Sun, 23 Dec 2012 07:25:27 +0000 (01:25 -0600)
main.c

diff --git a/main.c b/main.c
index 829b787..0cd1cb2 100644 (file)
--- 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);
 }