Mercurial > dovecot > core-2.2
changeset 4909:5ea3e08af1e2 HEAD
Added EDESTDIREXISTS() macro, and changed rename() calls to use it.
author | Timo Sirainen <tss@iki.fi> |
---|---|
date | Sat, 16 Dec 2006 01:08:42 +0200 |
parents | 94c302ea79bd |
children | e66dc3774099 |
files | src/lib-storage/index/maildir/maildir-storage.c src/lib/compat.h |
diffstat | 2 files changed, 7 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- a/src/lib-storage/index/maildir/maildir-storage.c Sat Dec 16 00:52:11 2006 +0200 +++ b/src/lib-storage/index/maildir/maildir-storage.c Sat Dec 16 01:08:42 2006 +0200 @@ -661,9 +661,7 @@ mailbox listing sees it. */ count = 0; while (rename(src, dest) < 0 && count < 2) { - /* EBUSY is given by some NFS implementations */ - if (errno != EEXIST && errno != ENOTEMPTY && - errno != EBUSY) { + if (!EDESTDIREXISTS(errno)) { mail_storage_set_critical(_storage, "rename(%s, %s) failed: %m", src, dest); return -1; @@ -771,8 +769,7 @@ Anyway, the bug with merging is that if both folders have identically named subfolder they conflict. Just ignore those and leave them under the old folder. */ - if (rename(oldpath, newpath) == 0 || - errno == EEXIST || errno == ENOTEMPTY) + if (rename(oldpath, newpath) == 0 || EDESTDIREXISTS(errno)) ret = 1; else { mail_storage_set_critical(storage, @@ -842,7 +839,7 @@ return 0; } - if (errno == EEXIST) { + if (EDESTDIREXISTS(errno)) { mail_storage_set_error(_storage, "Target mailbox already exists"); return -1;
--- a/src/lib/compat.h Sat Dec 16 00:52:11 2006 +0200 +++ b/src/lib/compat.h Sat Dec 16 01:08:42 2006 +0200 @@ -199,4 +199,8 @@ #define ECANTLINK(errno) \ ((errno) == EXDEV || (errno) == EMLINK || (errno) == EPERM) +/* EBUSY is given by some NFS implementations */ +#define EDESTDIREXISTS(errno) \ + ((errno) == EEXIST || (errno) == ENOTEMPTY || (errno) == EBUSY) + #endif