aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRon Yorston <rmy@pobox.com>2016-10-24 08:56:56 +0100
committerRon Yorston <rmy@pobox.com>2016-10-24 08:56:56 +0100
commit418f43bea899493bb70a6eec6429b3de412be6e7 (patch)
treecdbc91cc6ed60d478fdc6717fdd9014e281d7439
parentbbb2af5e5016f5d79e0b5d0c1312934b3ccd815d (diff)
downloadbusybox-w32-418f43bea899493bb70a6eec6429b3de412be6e7.tar.gz
busybox-w32-418f43bea899493bb70a6eec6429b3de412be6e7.tar.bz2
busybox-w32-418f43bea899493bb70a6eec6429b3de412be6e7.zip
yes: add explicit error check for WIN32
The test script for md5sum uses 'yes $text | head'. This fails because of Microsoft Windows' dodgy handling of pipes. yes checks the return value of putchar for an error, but on WIN32 none comes when a pipe fails. ferror, OTOH, does report an error.
-rw-r--r--coreutils/yes.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/coreutils/yes.c b/coreutils/yes.c
index 5d799f09b..c3d3e8288 100644
--- a/coreutils/yes.c
+++ b/coreutils/yes.c
@@ -33,6 +33,10 @@ int yes_main(int argc UNUSED_PARAM, char **argv)
33 ++argv; 33 ++argv;
34 34
35 do { 35 do {
36#if ENABLE_PLATFORM_MINGW32
37 if (ferror(stdout) != 0)
38 break;
39#endif
36 pp = argv; 40 pp = argv;
37 while (1) { 41 while (1) {
38 fputs(*pp, stdout); 42 fputs(*pp, stdout);