diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2016-03-10 06:29:25 -0800 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2016-03-10 06:29:25 -0800 |
commit | 3c5f110cc29f8d3fbf2069c68d25ccebee46679e (patch) | |
tree | c9d31727b2379aafaab2b44198137b580f0b7f60 | |
parent | a6551d3c4b832ef4b724e6039c615dfd56d76b7e (diff) | |
download | txr-3c5f110cc29f8d3fbf2069c68d25ccebee46679e.tar.gz txr-3c5f110cc29f8d3fbf2069c68d25ccebee46679e.tar.bz2 txr-3c5f110cc29f8d3fbf2069c68d25ccebee46679e.zip |
Workaround for apparent putc bug in Cygwin.
This fix is required for the stream socket test case to pass.
Some interaction between a stdio stream in line buffering
mode and the putc function causes a stream to lose data.
If we use fputs instead to output a character, the
issue goes away.
* stream.c (se_putc): When compiling for Cygwin, construct
a one-character-long string and use fputs, rather than putc.
-rw-r--r-- | stream.c | 7 |
1 files changed, 7 insertions, 0 deletions
@@ -454,7 +454,14 @@ static int se_putc(int ch, FILE *f) { int ret; sig_save_enable; +#ifdef __CYGWIN__ + { + char out[2] = { ch, 0 }; + ret = fputs(out, f) == EOF ? EOF : ch; + } +#else ret = putc(ch, f); +#endif sig_restore_enable; return ret; } |