From d51d49e381e1eb690fdf0583f0b61121f6ad9911 Mon Sep 17 00:00:00 2001 From: Vsevolod Stakhov Date: Tue, 6 Mar 2018 08:43:04 +0000 Subject: [Minor] Allow to proxy empty files --- src/libutil/util.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'src/libutil') diff --git a/src/libutil/util.c b/src/libutil/util.c index c8de9a651..d025730ac 100644 --- a/src/libutil/util.c +++ b/src/libutil/util.c @@ -2483,8 +2483,16 @@ rspamd_file_xmap (const char *fname, guint mode, gsize *size, return NULL; } - if (fstat (fd, &sb) == -1 || !S_ISREG (sb.st_mode) || sb.st_size == 0) { + if (fstat (fd, &sb) == -1 || !S_ISREG (sb.st_mode)) { close (fd); + *size = (gsize)-1; + + return NULL; + } + + if (sb.st_size == 0) { + close (fd); + *size = (gsize)0; return NULL; } -- cgit v1.2.3