Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit bcb3a04

Browse files
committed
bugfix: enforce permission mask from backup_content.control when copying non-data file
1 parent 513bc48 commit bcb3a04

File tree

1 file changed

+1
-11
lines changed

1 file changed

+1
-11
lines changed

src/data.c

+1-11
Original file line numberDiff line numberDiff line change
@@ -955,7 +955,6 @@ copy_file(fio_location from_location, const char *to_root,
955955
size_t read_len = 0;
956956
int errno_tmp;
957957
char buf[BLCKSZ];
958-
struct stat st;
959958
pg_crc32 crc;
960959

961960
INIT_FILE_CRC32(true, crc);
@@ -999,15 +998,6 @@ copy_file(fio_location from_location, const char *to_root,
999998
to_path, strerror(errno_tmp));
1000999
}
10011000

1002-
/* stat source file to change mode of destination file */
1003-
if (fio_ffstat(in, &st) == -1)
1004-
{
1005-
fio_fclose(in);
1006-
fio_fclose(out);
1007-
elog(ERROR, "cannot stat \"%s\": %s", file->path,
1008-
strerror(errno));
1009-
}
1010-
10111001
/* copy content and calc CRC */
10121002
for (;;)
10131003
{
@@ -1064,7 +1054,7 @@ copy_file(fio_location from_location, const char *to_root,
10641054
file->crc = crc;
10651055

10661056
/* update file permission */
1067-
if (fio_chmod(to_path, st.st_mode, to_location) == -1)
1057+
if (fio_chmod(to_path, file->mode, to_location) == -1)
10681058
{
10691059
errno_tmp = errno;
10701060
fio_fclose(in);

0 commit comments

Comments
 (0)