diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2018-03-06 08:43:04 +0000 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2018-03-06 09:29:01 +0000 |
commit | d51d49e381e1eb690fdf0583f0b61121f6ad9911 (patch) | |
tree | 989d9ee2cb015bc2be426e345a1d43783d1d4b30 /src/libutil/util.c | |
parent | 978f85dfdef58c93e7277d7741f034566c18eb85 (diff) | |
download | rspamd-d51d49e381e1eb690fdf0583f0b61121f6ad9911.tar.gz rspamd-d51d49e381e1eb690fdf0583f0b61121f6ad9911.zip |
[Minor] Allow to proxy empty files
Diffstat (limited to 'src/libutil/util.c')
-rw-r--r-- | src/libutil/util.c | 10 |
1 files changed, 9 insertions, 1 deletions
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; } |