diff options
| author | Mattias Andrée <maandree@kth.se> | 2017-01-10 20:07:02 +0100 |
|---|---|---|
| committer | Mattias Andrée <maandree@kth.se> | 2017-01-10 20:07:02 +0100 |
| commit | 70158ed8bc74ce80a049c1beb71e85ae949778b2 (patch) | |
| tree | bcabd2964e2b07bf2eaa0aab10cd6dbe313fa6a4 /src/stream.h | |
| parent | Add vu-transpose (diff) | |
| download | blind-70158ed8bc74ce80a049c1beb71e85ae949778b2.tar.gz blind-70158ed8bc74ce80a049c1beb71e85ae949778b2.tar.bz2 blind-70158ed8bc74ce80a049c1beb71e85ae949778b2.tar.xz | |
Refuse infinite writes to regular files
Signed-off-by: Mattias Andrée <maandree@kth.se>
Diffstat (limited to 'src/stream.h')
| -rw-r--r-- | src/stream.h | 34 |
1 files changed, 31 insertions, 3 deletions
diff --git a/src/stream.h b/src/stream.h index ccba77f..26771fa 100644 --- a/src/stream.h +++ b/src/stream.h @@ -15,14 +15,42 @@ struct stream const char *file; }; -void einit_stream(struct stream *stream); + void eninit_stream(int status, struct stream *stream); +static inline void +einit_stream(struct stream *stream) +{ + eninit_stream(1, stream); +} + + int set_pixel_size(struct stream *stream); -void eset_pixel_size(struct stream *stream); void enset_pixel_size(int status, struct stream *stream); +static inline void +eset_pixel_size(struct stream *stream) +{ + enset_pixel_size(1, stream); +} + + void fprint_stream_head(FILE *fp, struct stream *stream); -size_t eread_stream(struct stream *stream, size_t n); + size_t enread_stream(int status, struct stream *stream, size_t n); + +static inline size_t +eread_stream(struct stream *stream, size_t n) +{ + return enread_stream(1, stream, n); +} + + +void eninf_check_fd(int status, int fd, const char *file); + +static inline void +einf_check_fd(int fd, const char *file) +{ + eninf_check_fd(1, fd, file); +} |
