aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2010-02-23 05:44:55 +0000
committerTom Lane <tgl@sss.pgh.pa.us>2010-02-23 05:44:55 +0000
commitc3a24e3143e35af141145cdb082a6e66dded922b (patch)
tree9c67e79d177f95a156f32aa7a6e4868c70c0e3ab
parent1180b640759b32d63aa95fe8c4a44bec06c65ccb (diff)
downloadpostgresql-c3a24e3143e35af141145cdb082a6e66dded922b.tar.gz
postgresql-c3a24e3143e35af141145cdb082a6e66dded922b.zip
Some platforms reject fsync() on files opened O_RDONLY.
-rw-r--r--src/port/copydir.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/src/port/copydir.c b/src/port/copydir.c
index 3cd7db7a4cd..14c6ffe7691 100644
--- a/src/port/copydir.c
+++ b/src/port/copydir.c
@@ -11,7 +11,7 @@
* as a service.
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/port/copydir.c,v 1.31 2010/02/22 15:29:46 tgl Exp $
+ * $PostgreSQL: pgsql/src/port/copydir.c,v 1.32 2010/02/23 05:44:55 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -221,7 +221,7 @@ static void
fsync_fname(char *fname)
{
int fd = BasicOpenFile(fname,
- O_RDONLY | PG_BINARY,
+ O_RDWR | PG_BINARY,
S_IRUSR | S_IWUSR);
if (fd < 0)
@@ -229,8 +229,6 @@ fsync_fname(char *fname)
(errcode_for_file_access(),
errmsg("could not open file \"%s\": %m", fname)));
- errno = 0;
-
if (pg_fsync(fd) != 0)
ereport(ERROR,
(errcode_for_file_access(),