Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit c3a24e3

Browse files
committed
Some platforms reject fsync() on files opened O_RDONLY.
1 parent 1180b64 commit c3a24e3

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

src/port/copydir.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
* as a service.
1212
*
1313
* IDENTIFICATION
14-
* $PostgreSQL: pgsql/src/port/copydir.c,v 1.31 2010/02/22 15:29:46 tgl Exp $
14+
* $PostgreSQL: pgsql/src/port/copydir.c,v 1.32 2010/02/23 05:44:55 tgl Exp $
1515
*
1616
*-------------------------------------------------------------------------
1717
*/
@@ -221,16 +221,14 @@ static void
221221
fsync_fname(char *fname)
222222
{
223223
int fd = BasicOpenFile(fname,
224-
O_RDONLY | PG_BINARY,
224+
O_RDWR | PG_BINARY,
225225
S_IRUSR | S_IWUSR);
226226

227227
if (fd < 0)
228228
ereport(ERROR,
229229
(errcode_for_file_access(),
230230
errmsg("could not open file \"%s\": %m", fname)));
231231

232-
errno = 0;
233-
234232
if (pg_fsync(fd) != 0)
235233
ereport(ERROR,
236234
(errcode_for_file_access(),

0 commit comments

Comments
 (0)