summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Lane2010-02-22 15:29:46 +0000
committerTom Lane2010-02-22 15:29:46 +0000
commit9dd6c4686bc496912f1b4958139931ef6a6f029b (patch)
tree4b156285dcb6adf3dc5c7e10e1843f6e7f95c585
parente9a383303ce2f47a2733419e8d23e9e5a20b5ff2 (diff)
Let's try forcing errno to zero before issuing fsync. The current buildfarm
results claiming EBADF seem improbable enough that I'm not convinced fsync is really returning that --- could it be failing to set errno at all?
-rw-r--r--src/port/copydir.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/port/copydir.c b/src/port/copydir.c
index df763daa47f..3cd7db7a4cd 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.30 2010/02/22 02:50:10 tgl Exp $
+ * $PostgreSQL: pgsql/src/port/copydir.c,v 1.31 2010/02/22 15:29:46 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -229,9 +229,12 @@ 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(),
errmsg("could not fsync file \"%s\": %m", fname)));
+
close(fd);
}