src/platform_posix.c
changeset 1335 1b9a72908ece
parent 1327 998351d485d9
child 1402 c5a5dadb901d
--- a/src/platform_posix.c	Tue Aug 20 13:36:34 2013 -0400
+++ b/src/platform_posix.c	Wed Aug 21 23:30:33 2013 -0400
@@ -279,7 +279,8 @@
 int __PHYSFS_platformFlush(void *opaque)
 {
     const int fd = *((int *) opaque);
-    BAIL_IF_MACRO(fsync(fd) == -1, errcodeFromErrno(), 0);
+    if ((fcntl(fd, F_GETFL) & O_ACCMODE) != O_RDONLY)
+        BAIL_IF_MACRO(fsync(fd) == -1, errcodeFromErrno(), 0);
     return 1;
 } /* __PHYSFS_platformFlush */