summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/package.cc
diff options
context:
space:
mode:
authorAdam Borowski <kilobyte@angband.pl>2012-09-22 02:06:53 +0200
committerAdam Borowski <kilobyte@angband.pl>2012-09-22 02:06:53 +0200
commit087851d9f0ff519f4c1907e229f9b3972b44aabf (patch)
tree8ae18a4151c542c290e9cf65f534c8f33f8470c5 /crawl-ref/source/package.cc
parentb16ce641bc47d4a723c35128da5867a2142e6e0d (diff)
downloadcrawl-ref-087851d9f0ff519f4c1907e229f9b3972b44aabf.tar.gz
crawl-ref-087851d9f0ff519f4c1907e229f9b3972b44aabf.zip
Don't fsync() --no-save saves.
The temp file is still needed because the "game" might move through levels, but a pre-deleted file is quite unlikely to require durable storage.
Diffstat (limited to 'crawl-ref/source/package.cc')
-rw-r--r--crawl-ref/source/package.cc8
1 files changed, 4 insertions, 4 deletions
diff --git a/crawl-ref/source/package.cc b/crawl-ref/source/package.cc
index fbe479dcba..332126ffe4 100644
--- a/crawl-ref/source/package.cc
+++ b/crawl-ref/source/package.cc
@@ -87,7 +87,7 @@ typedef map<len_t, bm_p> bm_t;
typedef map<len_t, len_t> fb_t;
package::package(const char* file, bool writeable, bool empty)
- : n_users(0), dirty(false), aborted(false)
+ : n_users(0), dirty(false), aborted(false), tmp(false)
{
dprintf("package: initializing file=\"%s\" rw=%d\n", file, writeable);
ASSERT(writeable || !empty);
@@ -131,7 +131,7 @@ package::package(const char* file, bool writeable, bool empty)
}
package::package()
- : rw(true), n_users(0), dirty(false), aborted(false)
+ : rw(true), n_users(0), dirty(false), aborted(false), tmp(true)
{
dprintf("package: initializing tmp file\n");
filename = "[tmp]";
@@ -245,14 +245,14 @@ void package::commit()
head.start = htole(write_directory());
#ifdef DO_FSYNC
// We need a barrier before updating the link to point at the new directory.
- if (fdatasync(fd))
+ if (!tmp && fdatasync(fd))
sysfail("flush error while saving");
#endif
seek(0);
if (write(fd, &head, sizeof(head)) != sizeof(head))
sysfail("write error while saving");
#ifdef DO_FSYNC
- if (fdatasync(fd))
+ if (!tmp && fdatasync(fd))
sysfail("flush error while saving");
#endif