dovecot-2.2: fs-posix: When deleting a directory, automatically ...
dovecot at dovecot.org
dovecot at dovecot.org
Thu Sep 18 00:19:44 UTC 2014
details: http://hg.dovecot.org/dovecot-2.2/rev/677cdc451031
changeset: 17822:677cdc451031
user: Timo Sirainen <tss at iki.fi>
date: Thu Sep 18 02:19:32 2014 +0200
description:
fs-posix: When deleting a directory, automatically fallback to rmdir()ing it
diffstat:
src/lib-fs/fs-posix.c | 12 ++++++++++--
1 files changed, 10 insertions(+), 2 deletions(-)
diffs (22 lines):
diff -r 21757e66053f -r 677cdc451031 src/lib-fs/fs-posix.c
--- a/src/lib-fs/fs-posix.c Tue Sep 16 23:22:59 2014 +0300
+++ b/src/lib-fs/fs-posix.c Thu Sep 18 02:19:32 2014 +0200
@@ -644,8 +644,16 @@
struct posix_fs *fs = (struct posix_fs *)_file->fs;
if (unlink(_file->path) < 0) {
- fs_set_error(_file->fs, "unlink(%s) failed: %m", _file->path);
- return -1;
+ if (!UNLINK_EISDIR(errno)) {
+ fs_set_error(_file->fs, "unlink(%s) failed: %m", _file->path);
+ return -1;
+ }
+ /* attempting to delete a directory. convert it to rmdir()
+ automatically. */
+ if (rmdir(_file->path) < 0) {
+ fs_set_error(_file->fs, "rmdir(%s) failed: %m", _file->path);
+ return -1;
+ }
}
(void)fs_posix_rmdir_parents(fs, _file->path);
return 0;
More information about the dovecot-cvs
mailing list