mirror of
https://git.postgresql.org/git/postgresql.git
synced 2024-09-03 06:47:18 +02:00
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
This commit is contained in:
parent
4349a76158
commit
24872bbf92
@ -62,9 +62,11 @@ cloneFile(const char *src, const char *dst,
|
|||||||
|
|
||||||
if (ioctl(dest_fd, FICLONE, src_fd) < 0)
|
if (ioctl(dest_fd, FICLONE, src_fd) < 0)
|
||||||
{
|
{
|
||||||
|
int save_errno = errno;
|
||||||
|
|
||||||
unlink(dst);
|
unlink(dst);
|
||||||
pg_fatal("error while cloning relation \"%s.%s\" (\"%s\" to \"%s\"): %s\n",
|
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);
|
close(src_fd);
|
||||||
|
Loading…
Reference in New Issue
Block a user