aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2014-03-30 22:10:58 +0100
committerVsevolod Stakhov <vsevolod@highsecure.ru>2014-03-30 22:10:58 +0100
commit2c7172186c377ac599c626543639c542ab7fca3a (patch)
treeaa6a4b828dbaffedb779235a6ea2899f592ea4ea
parentb5ad7edb1ebfe9d928747a3636ef9441bb0a9d63 (diff)
downloadrspamd-2c7172186c377ac599c626543639c542ab7fca3a.tar.gz
rspamd-2c7172186c377ac599c626543639c542ab7fca3a.zip
Improve error reporting.
-rw-r--r--src/http.c20
1 files changed, 14 insertions, 6 deletions
diff --git a/src/http.c b/src/http.c
index 81e8f8f5c..c82237b50 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;