dovecot-2.0: lib-master: If config lookup from socket fails, fal...
dovecot at dovecot.org
dovecot at dovecot.org
Sat Mar 6 12:26:13 EET 2010
details: http://hg.dovecot.org/dovecot-2.0/rev/1a76670bb50e
changeset: 10841:1a76670bb50e
user: Timo Sirainen <tss at iki.fi>
date: Sat Mar 06 12:26:10 2010 +0200
description:
lib-master: If config lookup from socket fails, fallback to execing doveconf.
diffstat:
src/lib-master/master-service-settings.c | 27 +++++++++++++++++++--------
1 files changed, 19 insertions(+), 8 deletions(-)
diffs (65 lines):
diff -r 211df1a0646e -r 1a76670bb50e src/lib-master/master-service-settings.c
--- a/src/lib-master/master-service-settings.c Sat Mar 06 12:17:13 2010 +0200
+++ b/src/lib-master/master-service-settings.c Sat Mar 06 12:26:10 2010 +0200
@@ -102,6 +102,22 @@
i_fatal("execv(%s) failed: %m", conf_argv[0]);
}
+static void
+config_exec_fallback(struct master_service *service,
+ const struct master_service_settings_input *input)
+{
+ const char *path;
+ struct stat st;
+
+ path = input->config_path != NULL ? input->config_path :
+ master_service_get_config_path(service);
+ if (stat(path, &st) == 0 &&
+ !S_ISSOCK(st.st_mode) && !S_ISFIFO(st.st_mode)) {
+ /* it's a file, not a socket/pipe */
+ master_service_exec_config(service, input->preserve_home);
+ }
+}
+
static int
master_service_open_config(struct master_service *service,
const struct master_service_settings_input *input,
@@ -109,7 +125,6 @@
bool *standalone_config_from_socket_r)
{
const char *path;
- struct stat st;
int fd;
*path_r = path = input->config_path != NULL ? input->config_path :
@@ -142,13 +157,7 @@
if (fd < 0) {
*error_r = t_strdup_printf("net_connect_unix(%s) failed: %m",
path);
-
- if (stat(path, &st) == 0 &&
- !S_ISSOCK(st.st_mode) && !S_ISFIFO(st.st_mode)) {
- /* it's a file, not a socket/pipe */
- master_service_exec_config(service,
- input->preserve_home);
- }
+ config_exec_fallback(service, input);
return -1;
}
net_set_nonblock(fd, FALSE);
@@ -286,6 +295,7 @@
if (config_send_request(input, fd, path, error_r) < 0) {
(void)close(fd);
+ config_exec_fallback(service, input);
return -1;
}
config_socket = TRUE;
@@ -350,6 +360,7 @@
"Timeout reading config from %s", path);
}
(void)close(fd);
+ config_exec_fallback(service, input);
return -1;
}
}
More information about the dovecot-cvs
mailing list