X-Git-Url: http://erislabs.net/gitweb/?a=blobdiff_plain;f=lib%2Ffsync.c;h=c0b447c755affffb1644c7d8c8000dbd8e59268d;hb=06ef7ef9193810369b351b00548cfaa48fad0952;hp=f0fc8e5d38b950a698d9cb7201fee863f39ce5df;hpb=86fd2114ac3940e03a02e99658c8df88aed8a235;p=gnulib.git diff --git a/lib/fsync.c b/lib/fsync.c index f0fc8e5d3..c0b447c75 100644 --- a/lib/fsync.c +++ b/lib/fsync.c @@ -7,7 +7,7 @@ Written by Richard W.M. Jones - Copyright (C) 2008-2011 Free Software Foundation, Inc. + Copyright (C) 2008-2012 Free Software Foundation, Inc. This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public @@ -27,15 +27,15 @@ #if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__ -/* _get_osfhandle */ -# include - /* FlushFileBuffers */ # define WIN32_LEAN_AND_MEAN # include # include +/* Get _get_osfhandle. */ +# include "msvc-nothrow.h" + int fsync (int fd) { @@ -57,6 +57,11 @@ fsync (int fd) err = GetLastError (); switch (err) { + case ERROR_ACCESS_DENIED: + /* For a read-only handle, fsync should succeed, even though we have + no way to sync the access-time changes. */ + return 0; + /* eg. Trying to fsync a tty. */ case ERROR_INVALID_HANDLE: errno = EINVAL;