session->upstream_state = SMTP_STATE_IN_SENDFILE;
session->state = SMTP_STATE_WAIT_UPSTREAM;
if (! rspamd_dispatcher_sendfile (session->upstream_dispatcher, session->temp_fd, session->temp_size)) {
+ msg_err ("sendfile failed: %s", strerror (errno));
goto err;
}
return TRUE;
char *s;
if (fstat (session->temp_fd, &st) == -1) {
+ msg_err ("fstat failed: %s", strerror (errno));
goto err;
}
/* Now mmap temp file if it is small enough */
#else
if ((session->task->msg->begin = mmap (NULL, st.st_size, PROT_READ, MAP_SHARED, session->temp_fd, 0)) == MAP_FAILED) {
#endif
+ msg_err ("mmap failed: %s", strerror (errno));
goto err;
}
session->task->msg->len = st.st_size;
if (process_message (session->task) == -1) {
msg_err ("cannot process message");
munmap (session->task->msg->begin, st.st_size);
+ msg_err ("process message failed: %s", strerror (errno));
goto err;
}
r = process_filters (session->task);
return FALSE;
}
else if (r == 1) {
- r = strlen (session->cfg->temp_dir) + sizeof ("/rspamd-XXXXXX.tmp");
+ r = strlen (session->cfg->temp_dir) + sizeof ("/rspamd-XXXXXX");
session->temp_name = memory_pool_alloc (session->pool, r);
- snprintf (session->temp_name, r, "%s%crspamd-XXXXXX.tmp", session->cfg->temp_dir, G_DIR_SEPARATOR);
+ snprintf (session->temp_name, r, "%s%crspamd-XXXXXX", session->cfg->temp_dir, G_DIR_SEPARATOR);
#ifdef HAVE_MKSTEMP
/* Umask is set before */
session->temp_fd = mkstemp (session->temp_name);
session->temp_fd = g_mkstemp_full (session->temp_name, O_RDWR, S_IWUSR | S_IRUSR);
#endif
if (session->temp_fd == -1) {
+ msg_err ("mkstemp error: %s", strerror (errno));
session->error = SMTP_ERROR_FILE;
session->state = SMTP_STATE_CRITICAL_ERROR;
rspamd_dispatcher_restore (session->dispatcher);