diff options
Diffstat (limited to 'src/stdio/putc_unlocked.c')
-rw-r--r-- | src/stdio/putc_unlocked.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/stdio/putc_unlocked.c b/src/stdio/putc_unlocked.c index 9a7b3a60..f3714af8 100644 --- a/src/stdio/putc_unlocked.c +++ b/src/stdio/putc_unlocked.c @@ -23,6 +23,14 @@ int putc_unlocked(int c, FILE *stream) } stream->operation = OP_OUTPUT; + if (stream->buf == NULL) { + if (write(stream->fd, &ch, 1) != 1) { + stream->err = 1; + return EOF; + } + return ch; + } + stream->buf[stream->bpos++] = ch; if (stream->bpos == stream->bsize || (stream->bmode == _IOLBF && ch == '\n') || |