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;
}
TRUE);
if (session->map == NULL) {
- msg_err_session ("cannot map %s: %s", file_str, strerror (errno));
+ if (session->map_len != 0) {
+ msg_err_session ("cannot map %s: %s", file_str,
+ strerror (errno));
- return FALSE;
+ return FALSE;
+ }
}
/* Remove header after processing */
rspamd_http_message_remove_header (msg, "File");
&session->map_len, TRUE);
if (session->map == NULL) {
- msg_err_session ("cannot map %s: %s", file_str, strerror (errno));
- g_hash_table_unref (query_args);
+ if (session->map_len != 0) {
+ msg_err_session ("cannot map %s: %s", file_str,
+ strerror (errno));
+ g_hash_table_unref (query_args);
- return FALSE;
+ return FALSE;
+ }
}
/* We need to create a new URL with file attribute removed */