projects
/
gnulib.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
doc: use ASCII in .texi files where UTF-8 isn't needed
[gnulib.git]
/
lib
/
fsync.c
diff --git
a/lib/fsync.c
b/lib/fsync.c
index
8dea41a
..
a392e31
100644
(file)
--- a/
lib/fsync.c
+++ b/
lib/fsync.c
@@
-7,7
+7,7
@@
Written by Richard W.M. Jones <rjones.at.redhat.com>
Written by Richard W.M. Jones <rjones.at.redhat.com>
- Copyright (C) 2008-201
1
Free Software Foundation, Inc.
+ Copyright (C) 2008-201
4
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
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
@@
-27,14
+27,14
@@
#if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
#if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
-/* _get_osfhandle */
-#include <io.h>
-
/* FlushFileBuffers */
/* FlushFileBuffers */
-#define WIN32_LEAN_AND_MEAN
-#include <windows.h>
+# define WIN32_LEAN_AND_MEAN
+# include <windows.h>
+
+# include <errno.h>
-#include <errno.h>
+/* Get _get_osfhandle. */
+# include "msvc-nothrow.h"
int
fsync (int fd)
int
fsync (int fd)
@@
-57,6
+57,11
@@
fsync (int fd)
err = GetLastError ();
switch (err)
{
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;
/* eg. Trying to fsync a tty. */
case ERROR_INVALID_HANDLE:
errno = EINVAL;
@@
-73,6
+78,6
@@
fsync (int fd)
#else /* !Windows */
#else /* !Windows */
-#error "This platform lacks fsync function, and Gnulib doesn't provide a replacement. This is a bug in Gnulib."
+#
error "This platform lacks fsync function, and Gnulib doesn't provide a replacement. This is a bug in Gnulib."
#endif /* !Windows */
#endif /* !Windows */