dovecot-2.2: unlink_directory(): Added UNLINK_DIRECTORY_FLAG_FIL...
dovecot at dovecot.org
dovecot at dovecot.org
Mon Nov 26 23:08:55 EET 2012
details: http://hg.dovecot.org/dovecot-2.2/rev/a39024316d8e
changeset: 15403:a39024316d8e
user: Timo Sirainen <tss at iki.fi>
date: Mon Nov 26 23:08:50 2012 +0200
description:
unlink_directory(): Added UNLINK_DIRECTORY_FLAG_FILES_ONLY
diffstat:
src/lib/unlink-directory.c | 6 +++++-
src/lib/unlink-directory.h | 4 +++-
2 files changed, 8 insertions(+), 2 deletions(-)
diffs (37 lines):
diff -r faa3a83282fb -r a39024316d8e src/lib/unlink-directory.c
--- a/src/lib/unlink-directory.c Mon Nov 26 23:08:10 2012 +0200
+++ b/src/lib/unlink-directory.c Mon Nov 26 23:08:50 2012 +0200
@@ -115,7 +115,8 @@
if (errno != ENOENT)
break;
errno = 0;
- } else if (S_ISDIR(st.st_mode)) {
+ } else if (S_ISDIR(st.st_mode) &&
+ (flags & UNLINK_DIRECTORY_FLAG_FILES_ONLY) == 0) {
if (unlink_directory_r(d->d_name, flags) < 0) {
if (errno != ENOENT)
break;
@@ -134,6 +135,9 @@
}
errno = 0;
}
+ } else if (S_ISDIR(st.st_mode) &&
+ (flags & UNLINK_DIRECTORY_FLAG_FILES_ONLY) != 0) {
+ /* skip directory */
} else if (old_errno == EBUSY &&
strncmp(d->d_name, ".nfs", 4) == 0) {
/* can't delete NFS files that are still
diff -r faa3a83282fb -r a39024316d8e src/lib/unlink-directory.h
--- a/src/lib/unlink-directory.h Mon Nov 26 23:08:10 2012 +0200
+++ b/src/lib/unlink-directory.h Mon Nov 26 23:08:50 2012 +0200
@@ -5,7 +5,9 @@
/* After unlinking all files, rmdir() the directory itself */
UNLINK_DIRECTORY_FLAG_RMDIR = 0x01,
/* Don't unlink any files beginning with "." */
- UNLINK_DIRECTORY_FLAG_SKIP_DOTFILES = 0x02
+ UNLINK_DIRECTORY_FLAG_SKIP_DOTFILES = 0x02,
+ /* Don't recurse into subdirectories */
+ UNLINK_DIRECTORY_FLAG_FILES_ONLY = 0x04
};
/* Unlink directory and/or everything under it.
More information about the dovecot-cvs
mailing list