Skip to content

Commit 95f0d6a

Browse files
committed
do not overwrite file permissions in 'pg_controldata -c'
1 parent 5a1e948 commit 95f0d6a

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

src/bin/pg_controldata/pg_controldata.c

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -349,14 +349,13 @@ WriteControlFile(ControlFileData ControlFile, const char *progname, const char *
349349
memset(buffer, 0, PG_CONTROL_SIZE);
350350
memcpy(buffer, &ControlFile, sizeof(ControlFileData));
351351

352-
unlink(ControlFilePath);
353-
354352
fd = open(ControlFilePath,
355-
O_RDWR | O_CREAT | O_EXCL | PG_BINARY,
353+
O_RDWR | PG_BINARY,
356354
S_IRUSR | S_IWUSR);
355+
357356
if (fd < 0)
358357
{
359-
fprintf(stderr, _("%s: could not create pg_control file: %s\n"),
358+
fprintf(stderr, _("%s: could not open pg_control file: %s\n"),
360359
progname, strerror(errno));
361360
exit(1);
362361
}

0 commit comments

Comments
 (0)