dovecot-2.0: lib-master: If config file can't be even stat()ed (...
dovecot at dovecot.org
dovecot at dovecot.org
Mon Sep 13 13:29:26 EEST 2010
details: http://hg.dovecot.org/dovecot-2.0/rev/c98cdeb2c67a
changeset: 12099:c98cdeb2c67a
user: Timo Sirainen <tss at iki.fi>
date: Mon Sep 13 11:29:23 2010 +0100
description:
lib-master: If config file can't be even stat()ed (e.g. permission error), give better error msg.
diffstat:
src/lib-master/master-service-settings.c | 10 ++++++++--
1 files changed, 8 insertions(+), 2 deletions(-)
diffs (27 lines):
diff -r 69a3dfe6dba3 -r c98cdeb2c67a src/lib-master/master-service-settings.c
--- a/src/lib-master/master-service-settings.c Mon Sep 13 10:48:28 2010 +0100
+++ b/src/lib-master/master-service-settings.c Mon Sep 13 11:29:23 2010 +0100
@@ -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 @@
/* 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;
More information about the dovecot-cvs
mailing list