diff options
Diffstat (limited to 'src/stdio/getc_unlocked.c')
| -rw-r--r-- | src/stdio/getc_unlocked.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/stdio/getc_unlocked.c b/src/stdio/getc_unlocked.c index 140e1a4d..0e68eb79 100644 --- a/src/stdio/getc_unlocked.c +++ b/src/stdio/getc_unlocked.c @@ -19,6 +19,12 @@ int getc_unlocked(FILE * stream) return EOF; } + if (stream->operation == OP_OUTPUT) { + UNDEFINED("attempted input on stream immediately after output"); + } + + stream->operation = OP_INPUT; + if (read(stream->fd, &c, sizeof(c)) != 1) { stream->err = 1; return EOF; |
