aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMichael Paquier <michael@paquier.xyz>2022-08-01 16:39:33 +0900
committerMichael Paquier <michael@paquier.xyz>2022-08-01 16:39:33 +0900
commit24872bbf9288d8949b3f2ed60c0f3ef12015016f (patch)
treec2efa9a8d606c81a18fe7cecc4a69c88dea09173 /src
parent4349a76158e5a1fd87178dc387ec03468cfef731 (diff)
downloadpostgresql-24872bbf9288d8949b3f2ed60c0f3ef12015016f.tar.gz
postgresql-24872bbf9288d8949b3f2ed60c0f3ef12015016f.zip
Fix error reporting after ioctl() call with pg_upgrade --clone
errno was not reported correctly after attempting to clone a file, leading to incorrect error reports. While scanning through the code, I have not noticed any similar mistakes. Error introduced in 3a769d8. Author: Justin Pryzby Discussion: https://postgr.es/m/20220731134135.GY15006@telsasoft.com Backpatch-through: 12
Diffstat (limited to 'src')
-rw-r--r--src/bin/pg_upgrade/file.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/bin/pg_upgrade/file.c b/src/bin/pg_upgrade/file.c
index c7fed24df93..76d18e9f094 100644
--- a/src/bin/pg_upgrade/file.c
+++ b/src/bin/pg_upgrade/file.c
@@ -62,9 +62,11 @@ cloneFile(const char *src, const char *dst,
if (ioctl(dest_fd, FICLONE, src_fd) < 0)
{
+ int save_errno = errno;
+
unlink(dst);
pg_fatal("error while cloning relation \"%s.%s\" (\"%s\" to \"%s\"): %s\n",
- schemaName, relName, src, dst, strerror(errno));
+ schemaName, relName, src, dst, strerror(save_errno));
}
close(src_fd);