dovecot-2.2: master: Problems with creating base_dir/statedir sh...
dovecot at dovecot.org
dovecot at dovecot.org
Sun Jun 24 21:44:06 EEST 2012
details: http://hg.dovecot.org/dovecot-2.2/rev/3ffdb4bf36d3
changeset: 14680:3ffdb4bf36d3
user: Timo Sirainen <tss at iki.fi>
date: Sun Jun 24 21:43:48 2012 +0300
description:
master: Problems with creating base_dir/statedir should be fatals.
diffstat:
src/master/master-settings.c | 33 +++++++++++----------------------
src/master/master-settings.h | 2 +-
2 files changed, 12 insertions(+), 23 deletions(-)
diffs (81 lines):
diff -r f783fdbc3861 -r 3ffdb4bf36d3 src/master/master-settings.c
--- a/src/master/master-settings.c Sun Jun 24 21:35:18 2012 +0300
+++ b/src/master/master-settings.c Sun Jun 24 21:43:48 2012 +0300
@@ -708,7 +708,7 @@
(void)closedir(dirp);
}
-bool master_settings_do_fixes(const struct master_settings *set)
+void master_settings_do_fixes(const struct master_settings *set)
{
const char *login_dir, *empty_dir;
struct stat st;
@@ -716,19 +716,13 @@
/* since base dir is under /var/run by default, it may have been
deleted. */
- if (mkdir_parents(set->base_dir, 0755) < 0 && errno != EEXIST) {
- i_error("mkdir(%s) failed: %m", set->base_dir);
- return FALSE;
- }
+ if (mkdir_parents(set->base_dir, 0755) < 0 && errno != EEXIST)
+ i_fatal("mkdir(%s) failed: %m", set->base_dir);
/* allow base_dir to be a symlink, so don't use lstat() */
- if (stat(set->base_dir, &st) < 0) {
- i_error("stat(%s) failed: %m", set->base_dir);
- return FALSE;
- }
- if (!S_ISDIR(st.st_mode)) {
- i_error("%s is not a directory", set->base_dir);
- return FALSE;
- }
+ if (stat(set->base_dir, &st) < 0)
+ i_fatal("stat(%s) failed: %m", set->base_dir);
+ if (!S_ISDIR(st.st_mode))
+ i_fatal("%s is not a directory", set->base_dir);
if ((st.st_mode & 0755) != 0755) {
i_warning("Fixing permissions of %s to be world-readable",
set->base_dir);
@@ -737,10 +731,8 @@
}
/* Make sure our permanent state directory exists */
- if (mkdir_parents(PKG_STATEDIR, 0750) < 0 && errno != EEXIST) {
- i_error("mkdir(%s) failed: %m", PKG_STATEDIR);
- return FALSE;
- }
+ if (mkdir_parents(PKG_STATEDIR, 0750) < 0 && errno != EEXIST)
+ i_fatal("mkdir(%s) failed: %m", PKG_STATEDIR);
login_dir = t_strconcat(set->base_dir, "/login", NULL);
if (settings_have_auth_unix_listeners_in(set, login_dir)) {
@@ -758,10 +750,8 @@
unlink_sockets(login_dir, "");
} else {
/* still make sure that login directory exists */
- if (mkdir(login_dir, 0755) < 0 && errno != EEXIST) {
- i_error("mkdir(%s) failed: %m", login_dir);
- return FALSE;
- }
+ if (mkdir(login_dir, 0755) < 0 && errno != EEXIST)
+ i_fatal("mkdir(%s) failed: %m", login_dir);
}
empty_dir = t_strconcat(set->base_dir, "/empty", NULL);
@@ -769,5 +759,4 @@
i_warning("Corrected permissions for empty directory "
"%s", empty_dir);
}
- return TRUE;
}
diff -r f783fdbc3861 -r 3ffdb4bf36d3 src/master/master-settings.h
--- a/src/master/master-settings.h Sun Jun 24 21:35:18 2012 +0300
+++ b/src/master/master-settings.h Sun Jun 24 21:43:48 2012 +0300
@@ -29,6 +29,6 @@
extern const struct setting_parser_info master_setting_parser_info;
-bool master_settings_do_fixes(const struct master_settings *set);
+void master_settings_do_fixes(const struct master_settings *set);
#endif
More information about the dovecot-cvs
mailing list