Mercurial > dovecot > original-hg > dovecot-1.2
changeset 8012:164bdad216b8 HEAD
fdatasync_path(): Ignore EBADF errors, it probably means directory fsyncing
isn't allowed (e.g. NetBSD).
author | Timo Sirainen <tss@iki.fi> |
---|---|
date | Sun, 20 Jul 2008 15:24:05 +0300 |
parents | 2d902d1f8bea |
children | 7513ad244f0f |
files | src/lib/fdatasync-path.c |
diffstat | 1 files changed, 8 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/src/lib/fdatasync-path.c Sat Jul 19 14:43:24 2008 +0300 +++ b/src/lib/fdatasync-path.c Sun Jul 20 15:24:05 2008 +0300 @@ -15,8 +15,14 @@ fd = open(path, O_RDONLY); if (fd == -1) return -1; - if (fdatasync(fd) < 0) - ret = -1; + if (fdatasync(fd) < 0) { + if (errno == EBADF) { + /* At least NetBSD doesn't allow fsyncing directories. + Silently ignore the problem. */ + } else { + ret = -1; + } + } (void)close(fd); return ret; }