diff --git a/src/runtime/c/pgf/db.cxx b/src/runtime/c/pgf/db.cxx index 6e0e80d5f..4450c29fc 100644 --- a/src/runtime/c/pgf/db.cxx +++ b/src/runtime/c/pgf/db.cxx @@ -1077,7 +1077,13 @@ void PgfDB::sync() size_t size = ms->top + chunksize(ptr(ms,ms->top)) + sizeof(size_t); - int res = msync((void *) ms, size, MS_SYNC | MS_INVALIDATE); + int res; +#ifndef MREMAP_MAYMOVE + if (current_db->fd < 0) { + res = 0; + } else +#endif + res = msync((void *) ms, size, MS_SYNC | MS_INVALIDATE); if (res != 0) throw pgf_systemerror(errno); }