dovecot-2.2: lib-fs: If backend doesn't implement exists(), emul...
dovecot at dovecot.org
dovecot at dovecot.org
Sat Sep 14 00:27:12 EEST 2013
details: http://hg.dovecot.org/dovecot-2.2/rev/d483e6eb9a2c
changeset: 16728:d483e6eb9a2c
user: Timo Sirainen <tss at iki.fi>
date: Sat Sep 14 00:26:45 2013 +0300
description:
lib-fs: If backend doesn't implement exists(), emulate it with stat().
diffstat:
src/lib-fs/fs-api.c | 8 ++++++++
1 files changed, 8 insertions(+), 0 deletions(-)
diffs (20 lines):
diff -r 1db5ede2a1cd -r d483e6eb9a2c src/lib-fs/fs-api.c
--- a/src/lib-fs/fs-api.c Thu Sep 12 03:52:01 2013 +0300
+++ b/src/lib-fs/fs-api.c Sat Sep 14 00:26:45 2013 +0300
@@ -536,8 +536,16 @@
int fs_exists(struct fs_file *file)
{
+ struct stat st;
int ret;
+ if (file->fs->v.exists == NULL) {
+ /* fallback to stat() */
+ if (fs_stat(file, &st) == 0)
+ return 1;
+ else
+ return errno == ENOENT ? 0 : -1;
+ }
T_BEGIN {
ret = file->fs->v.exists(file);
} T_END;
More information about the dovecot-cvs
mailing list