diff options
| author | Jakob Kaivo <jkk@ung.org> | 2024-05-27 12:49:46 -0400 |
|---|---|---|
| committer | Jakob Kaivo <jkk@ung.org> | 2024-05-27 12:49:46 -0400 |
| commit | 04e5527eeca240ca81b0b95b58c50ef6a16b8030 (patch) | |
| tree | 3623519b07b9f3c027fa13fac925923dd05a3baa /src/stdio/_stdio.h | |
| parent | 9b784a3affb4027c9bc40fba2b272abe7e580ece (diff) | |
handle UB for invalid fflush() operations and mixing input and output without intervening fflush() or repositioning
Diffstat (limited to 'src/stdio/_stdio.h')
| -rw-r--r-- | src/stdio/_stdio.h | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/src/stdio/_stdio.h b/src/stdio/_stdio.h index c69b3787..cf53179d 100644 --- a/src/stdio/_stdio.h +++ b/src/stdio/_stdio.h @@ -25,6 +25,7 @@ #define ORIENT_WIDE (1) #define ORIENT_BYTE (-1) +#define OP_NONE (0) #define OP_INPUT (1) #define OP_OUTPUT (2) @@ -58,11 +59,13 @@ struct __FILE { int nlocks; /* in multithreaded, used by flockfile() */ int thread; /* the owning thread if locked */ - int orientation:2; /* 0 = undetermind, < 0 = byte, > 0 = wide */ - int operation:2; /* TODO: previous operation, NONE, INPUT, OUTPUT (are there others?) */ - int eof:1; /* eof indicator */ - int err:1; /* error indicator */ - int text:1; /* is this a text file? */ + unsigned int orientation:2; /* 0 = undetermind, < 0 = byte, > 0 = wide */ + unsigned int operation:2; /* TODO: previous operation, NONE, INPUT, OUTPUT (are there others?) */ + unsigned int eof:1; /* eof indicator */ + unsigned int err:1; /* error indicator */ + unsigned int text:1; /* is this a text file? */ + unsigned int read:1; /* open for reading? */ + unsigned int write:1; /* open for writing? */ #ifdef _POSIX_C_SOURCE pid_t pipe_pid; /* if stream is a pipe, the child pid */ |
