Mercurial > dovecot > original-hg > dovecot-1.2
view src/lib/fdatasync-path.c @ 8590:b9faf4db2a9f HEAD
Updated copyright notices to include year 2009.
author | Timo Sirainen <tss@iki.fi> |
---|---|
date | Tue, 06 Jan 2009 09:25:38 -0500 |
parents | 164bdad216b8 |
children | ebfcfa35b4f4 |
line wrap: on
line source
/* Copyright (c) 2008-2009 Dovecot authors, see the included COPYING file */ #include "lib.h" #include "fdatasync-path.h" #include <fcntl.h> #include <unistd.h> int fdatasync_path(const char *path) { int fd, ret = 0; /* Directories need to be opened as read-only. fsync() doesn't appear to care about it. */ fd = open(path, O_RDONLY); if (fd == -1) return -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; }