diff --git a/docs/CREDITS.txt b/docs/CREDITS.txt index b961e72..aa5d023 100644 --- a/docs/CREDITS.txt +++ b/docs/CREDITS.txt @@ -136,6 +136,9 @@ SLB archiver: Bug fixes: Dmitry Marakasov +Bug fixes: + Andreas Karlsson + Other stuff: Your name here! Patches go to icculus@icculus.org ... diff --git a/src/platform_posix.c b/src/platform_posix.c index 71f8ba0..018ae76 100644 --- a/src/platform_posix.c +++ b/src/platform_posix.c @@ -279,7 +279,8 @@ PHYSFS_sint64 __PHYSFS_platformFileLength(void *opaque) 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 */