dovecot-2.0: eacces_error_get*(): Handle errors to / directory b...
dovecot at dovecot.org
dovecot at dovecot.org
Wed Mar 16 18:37:16 EET 2011
details: http://hg.dovecot.org/dovecot-2.0/rev/46d46fa3929f
changeset: 12685:46d46fa3929f
user: Timo Sirainen <tss at iki.fi>
date: Wed Mar 16 18:37:14 2011 +0200
description:
eacces_error_get*(): Handle errors to / directory better.
diffstat:
src/lib/eacces-error.c | 7 ++++---
1 files changed, 4 insertions(+), 3 deletions(-)
diffs (21 lines):
diff -r 7d9db422549a -r 46d46fa3929f src/lib/eacces-error.c
--- a/src/lib/eacces-error.c Wed Mar 16 18:20:47 2011 +0200
+++ b/src/lib/eacces-error.c Wed Mar 16 18:37:14 2011 +0200
@@ -126,13 +126,14 @@
memset(&dir_st, 0, sizeof(dir_st));
while ((p = strrchr(prev_path, '/')) != NULL) {
- dir = t_strdup_until(prev_path, p);
+ dir = p == prev_path ? "/" : t_strdup_until(prev_path, p);
ret = stat(dir, &st);
if (ret == 0)
break;
- if (errno == EACCES) {
+ if (errno == EACCES && strcmp(dir, "/") != 0) {
/* see if we have access to parent directory */
- } else if (errno == ENOENT && creating) {
+ } else if (errno == ENOENT && creating &&
+ strcmp(dir, "/") != 0) {
/* probably mkdir_parents() failed here, find the first
parent directory we couldn't create */
} else {
More information about the dovecot-cvs
mailing list