From 70158ed8bc74ce80a049c1beb71e85ae949778b2 Mon Sep 17 00:00:00 2001 From: Mattias Andrée Date: Tue, 10 Jan 2017 20:07:02 +0100 Subject: Refuse infinite writes to regular files MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Mattias Andrée --- src/stream.h | 34 +++++++++++++++++++++++++++++++--- 1 file changed, 31 insertions(+), 3 deletions(-) (limited to 'src/stream.h') 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); +} -- cgit v1.2.3-70-g09d2