From: Vsevolod Stakhov Date: Sun, 30 Mar 2014 21:10:58 +0000 (+0100) Subject: Improve error reporting. X-Git-Tag: 0.7.0~338 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=2c7172186c377ac599c626543639c542ab7fca3a;p=thirdparty%2Frspamd.git Improve error reporting. --- diff --git a/src/http.c b/src/http.c index 81e8f8f5c1..c82237b50d 100644 --- a/src/http.c +++ b/src/http.c @@ -26,6 +26,7 @@ #include "utlist.h" #include "util.h" #include "printf.h" +#include "logger.h" struct rspamd_http_connection_private { GString *buf; @@ -1063,12 +1064,19 @@ rspamd_http_router_new (rspamd_http_router_error_handler_t eh, new->ptv = NULL; } - if (default_fs_path != NULL && stat (default_fs_path, &st) != -1 && - S_ISDIR (st.st_mode)) { - new->default_fs_path = g_strdup (default_fs_path); - } - else { - new->default_fs_path = NULL; + new->default_fs_path = NULL; + if (default_fs_path != NULL) { + if (stat (default_fs_path, &st) == -1) { + msg_err ("cannot stat %s", default_fs_path); + } + else { + if (!S_ISDIR (st.st_mode)) { + msg_err ("path %s is not a directory", default_fs_path); + } + else { + new->default_fs_path = g_strdup (default_fs_path); + } + } } return new;