diff options
author | Ron Yorston <rmy@pobox.com> | 2016-10-24 08:56:56 +0100 |
---|---|---|
committer | Ron Yorston <rmy@pobox.com> | 2016-10-24 08:56:56 +0100 |
commit | 418f43bea899493bb70a6eec6429b3de412be6e7 (patch) | |
tree | cdbc91cc6ed60d478fdc6717fdd9014e281d7439 | |
parent | bbb2af5e5016f5d79e0b5d0c1312934b3ccd815d (diff) | |
download | busybox-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.c | 4 |
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); |