Skip to content

Commit

Permalink
Backport to stable-2.0: don't fsync read-only files.
Browse files Browse the repository at this point in the history
  • Loading branch information
icculus committed Aug 22, 2013
1 parent 038b0fa commit 87f4ed6
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
3 changes: 3 additions & 0 deletions CREDITS.txt
Expand Up @@ -109,6 +109,9 @@ Bug fixes:
Bug fixes:
Lauri Kasanen

Bug fixes:
Andreas Karlsson

Other stuff:
Your name here! Patches go to icculus@icculus.org ...

Expand Down
3 changes: 2 additions & 1 deletion platform/posix.c
Expand Up @@ -390,7 +390,8 @@ int __PHYSFS_platformEOF(void *opaque)
int __PHYSFS_platformFlush(void *opaque)
{
int fd = *((int *) opaque);
BAIL_IF_MACRO(fsync(fd) == -1, strerror(errno), 0);
if ((fcntl(fd, F_GETFL) & O_ACCMODE) != O_RDONLY)
BAIL_IF_MACRO(fsync(fd) == -1, strerror(errno), 0);
return(1);
} /* __PHYSFS_platformFlush */

Expand Down

0 comments on commit 87f4ed6

Please sign in to comment.