From: Timo Sirainen Date: Mon, 13 Sep 2010 10:29:23 +0000 (+0100) Subject: lib-master: If config file can't be even stat()ed (e.g. permission error), give bette... X-Git-Tag: 2.0.3~33 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=73fed8af5e20022bdef8620bb074507755ec2c5e;p=thirdparty%2Fdovecot%2Fcore.git lib-master: If config file can't be even stat()ed (e.g. permission error), give better error msg. --- diff --git a/src/lib-master/master-service-settings.c b/src/lib-master/master-service-settings.c index ac1ab8c922..08ab1aa269 100644 --- a/src/lib-master/master-service-settings.c +++ b/src/lib-master/master-service-settings.c @@ -6,6 +6,7 @@ #include "istream.h" #include "write-full.h" #include "str.h" +#include "eacces-error.h" #include "execv-const.h" #include "settings-parser.h" #include "master-service-private.h" @@ -160,8 +161,13 @@ master_service_open_config(struct master_service *service, /* fallback to executing doveconf */ } - if (stat(path, &st) == 0 && - !S_ISSOCK(st.st_mode) && !S_ISFIFO(st.st_mode)) { + if (stat(path, &st) < 0) { + *error_r = errno == EACCES ? eacces_error_get("stat", path) : + t_strdup_printf("stat(%s) failed: %m", path); + return -1; + } + + if (!S_ISSOCK(st.st_mode) && !S_ISFIFO(st.st_mode)) { /* it's not an UNIX socket, don't even try to connect */ fd = -1; errno = ENOTSOCK;