# HG changeset patch # User Rob Landley # Date 1356247527 21600 # Node ID 6a558bf5de65c51b5bfa6ce99fcb2d6b0ae9d305 # Parent 41b067739bd0446a5829c91c54bc0ed01eef0abc 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.) diff -r 41b067739bd0 -r 6a558bf5de65 main.c --- a/main.c Sun Dec 23 01:21:01 2012 -0600 +++ b/main.c Sun Dec 23 01:25:27 2012 -0600 @@ -102,6 +102,7 @@ if (!which) return; toy_init(which, argv); toys.which->toy_main(); + if (fflush(NULL) || ferror(stdout)) perror_exit("write"); exit(toys.exitval); }