summaryrefslogtreecommitdiffstats
path: root/src/basic/fileio.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/basic/fileio.h')
-rw-r--r--src/basic/fileio.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/basic/fileio.h b/src/basic/fileio.h
index cea3dd893d..9151d8237a 100644
--- a/src/basic/fileio.h
+++ b/src/basic/fileio.h
@@ -110,6 +110,12 @@ typedef enum ReadLineFlags {
int read_line_full(FILE *f, size_t limit, ReadLineFlags flags, char **ret);
+static inline bool file_offset_beyond_memory_size(off_t x) {
+ if (x < 0) /* off_t is signed, filter that out */
+ return false;
+ return (uint64_t) x > (uint64_t) SIZE_MAX;
+}
+
static inline int read_line(FILE *f, size_t limit, char **ret) {
return read_line_full(f, limit, 0, ret);
}