summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Paquier2022-08-01 07:38:23 +0000
committerMichael Paquier2022-08-01 07:38:23 +0000
commit8b1ec7d2953273501c5cea8185b6358dc7709eb5 (patch)
tree90ef9799e40a29ba904f59cd85d9fa530579ab21
parent2827f108d136de518f8f1aa7b1bbef0588e0a680 (diff)
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/[email protected] Backpatch-through: 12
-rw-r--r--src/bin/pg_upgrade/file.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/bin/pg_upgrade/file.c b/src/bin/pg_upgrade/file.c
index c2ca99dcd8..079fbda838 100644
--- a/src/bin/pg_upgrade/file.c
+++ b/src/bin/pg_upgrade/file.c
@@ -57,9 +57,12 @@ 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",
- schemaName, relName, src, dst, strerror(errno));
+ schemaName, relName, src, dst, strerror(save_errno));
}
close(src_fd);