diff options
Diffstat (limited to 'src/stdio/putc_unlocked.c')
| -rw-r--r-- | src/stdio/putc_unlocked.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/stdio/putc_unlocked.c b/src/stdio/putc_unlocked.c index fffb2618..9a7b3a60 100644 --- a/src/stdio/putc_unlocked.c +++ b/src/stdio/putc_unlocked.c @@ -17,7 +17,12 @@ int putc_unlocked(int c, FILE *stream) SIGNAL_SAFE(0); ASSERT_NONNULL(stream); + + if (stream->operation == OP_INPUT) { + UNDEFINED("attempted output on stream immediately after input"); + } + stream->operation = OP_OUTPUT; stream->buf[stream->bpos++] = ch; if (stream->bpos == stream->bsize || (stream->bmode == _IOLBF && ch == '\n') || |
