From: Timo Sirainen Date: Sun, 20 Jul 2008 12:24:05 +0000 (+0300) Subject: fdatasync_path(): Ignore EBADF errors, it probably means directory fsyncing X-Git-Tag: 1.2.alpha1~149 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=79120460f7125f6de695f50d5fabfefd1fc529c5;p=thirdparty%2Fdovecot%2Fcore.git fdatasync_path(): Ignore EBADF errors, it probably means directory fsyncing isn't allowed (e.g. NetBSD). --HG-- branch : HEAD --- diff --git a/src/lib/fdatasync-path.c b/src/lib/fdatasync-path.c index 55d2ec2eaa..45593b9cf8 100644 --- a/src/lib/fdatasync-path.c +++ b/src/lib/fdatasync-path.c @@ -15,8 +15,14 @@ int fdatasync_path(const char *path) 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; }