This is an automated email from the ASF dual-hosted git repository.

maxyang pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/cloudberry.git

commit 208b70ef324c5afa9684dac551f9e4cc8b46ebb4
Author: Michael Paquier <[email protected]>
AuthorDate: Mon Aug 1 16:39:33 2022 +0900

    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
---
 src/bin/pg_upgrade/file.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/bin/pg_upgrade/file.c b/src/bin/pg_upgrade/file.c
index 4b223bf681..35936a4933 100644
--- a/src/bin/pg_upgrade/file.c
+++ b/src/bin/pg_upgrade/file.c
@@ -60,9 +60,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);


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to