From 1bfba107225171f51cc6f37774b31da8c5572fb0 Mon Sep 17 00:00:00 2001 From: Timo Sirainen Date: Fri, 16 Jan 2009 14:21:25 -0500 Subject: [PATCH] Fixes to handling +w permission errors and use it more often. --HG-- branch : HEAD --- src/lib-storage/index/mbox/mbox-storage.c | 6 +++--- src/lib-storage/mail-error.c | 10 +++++----- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/lib-storage/index/mbox/mbox-storage.c b/src/lib-storage/index/mbox/mbox-storage.c index df24f2d129..416258898d 100644 --- a/src/lib-storage/index/mbox/mbox-storage.c +++ b/src/lib-storage/index/mbox/mbox-storage.c @@ -266,7 +266,7 @@ static const char *create_root_dir(struct mail_storage *storage, path = t_strconcat(home, "/mail", NULL); if (mkdir_parents(path, CREATE_MODE) < 0 && errno != EEXIST) { - *error_r = t_strdup_printf("mkdir(%s) failed: %m", path); + *error_r = mail_error_create_eacces_msg("mkdir", path); return NULL; } @@ -362,8 +362,8 @@ mbox_get_list_settings(struct mailbox_list_settings *list_set, return -1; } else if (mkdir_parents(list_set->root_dir, CREATE_MODE) < 0 && errno != EEXIST) { - *error_r = t_strdup_printf("mkdir(%s) failed: %m", - list_set->root_dir); + *error_r = mail_error_create_eacces_msg("mkdir", + list_set->root_dir); return -1; } } diff --git a/src/lib-storage/mail-error.c b/src/lib-storage/mail-error.c index 92b21bd643..e1a79d65a5 100644 --- a/src/lib-storage/mail-error.c +++ b/src/lib-storage/mail-error.c @@ -77,16 +77,16 @@ mail_error_eacces_msg_full(const char *func, const char *path, bool creating) str_printfa(errmsg, " missing +x perm: %s", dir); else str_printfa(errmsg, " access(%s, x) failed: %m", dir); - } else if (prev_path == path && access(path, R_OK) < 0) { - if (errno == EACCES) - str_printfa(errmsg, " missing +r perm: %s", path); - else - str_printfa(errmsg, " access(%s, r) failed: %m", path); } else if (creating && access(dir, W_OK) < 0) { if (errno == EACCES) str_printfa(errmsg, " missing +w perm: %s", dir); else str_printfa(errmsg, " access(%s, w) failed: %m", dir); + } else if (prev_path == path && access(path, R_OK) < 0) { + if (errno == EACCES) + str_printfa(errmsg, " missing +r perm: %s", path); + else + str_printfa(errmsg, " access(%s, r) failed: %m", path); } else str_printfa(errmsg, " UNIX perms seem ok, ACL problem?"); } -- 2.47.3