Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commite99e840

Browse files
committed
Add headers needed by pg_combinebackup --clone
The code for file cloning existed, but was not reachable as it relied onconstants from missing headers. Due to that, on Linux --clone alwaysfailed with error: file cloning not supported on this platformFixed by including the missing headers to relevant places. Adding theheaders revealed a couple compile errors in copy_file_clone(), so fixthose too.Reported-by: Peter EisentrautDiscussion:https://postgr.es/m/48da4a1f-ccd9-4988-9622-24f37b1de2b4%40eisentraut.org
1 parent9177545 commite99e840

File tree

2 files changed

+19
-1
lines changed

2 files changed

+19
-1
lines changed

‎src/bin/pg_combinebackup/copy_file.c

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,10 @@
1313
#ifdefHAVE_COPYFILE_H
1414
#include<copyfile.h>
1515
#endif
16+
#ifdef__linux__
17+
#include<sys/ioctl.h>
18+
#include<linux/fs.h>
19+
#endif
1620
#include<fcntl.h>
1721
#include<limits.h>
1822
#include<sys/stat.h>
@@ -214,6 +218,9 @@ copy_file_clone(const char *src, const char *dest,
214218
pg_fatal("error while cloning file \"%s\" to \"%s\": %m",src,dest);
215219
#elif defined(__linux__)&& defined(FICLONE)
216220
{
221+
intsrc_fd;
222+
intdest_fd;
223+
217224
if ((src_fd=open(src,O_RDONLY |PG_BINARY,0))<0)
218225
pg_fatal("could not open file \"%s\": %m",src);
219226

@@ -228,8 +235,11 @@ copy_file_clone(const char *src, const char *dest,
228235
unlink(dest);
229236

230237
pg_fatal("error while cloning file \"%s\" to \"%s\": %s",
231-
src,dest);
238+
src,dest,strerror(save_errno));
232239
}
240+
241+
close(src_fd);
242+
close(dest_fd);
233243
}
234244
#else
235245
pg_fatal("file cloning not supported on this platform");

‎src/bin/pg_combinebackup/pg_combinebackup.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,14 @@
1616
#include<fcntl.h>
1717
#include<limits.h>
1818

19+
#ifdefHAVE_COPYFILE_H
20+
#include<copyfile.h>
21+
#endif
22+
#ifdef__linux__
23+
#include<sys/ioctl.h>
24+
#include<linux/fs.h>
25+
#endif
26+
1927
#include"backup_label.h"
2028
#include"common/blkreftable.h"
2129
#include"common/checksum_helper.h"

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp