Merge pull request #2425 from cgwalters/hardlink-correct-errno

checkout: Save errno when re-throwing
This commit is contained in:
Luca Bruno 2021-08-27 07:33:27 +00:00 committed by GitHub
commit 7fb0266df6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 0 deletions

View File

@ -481,6 +481,7 @@ checkout_file_hardlink (OstreeRepo *self,
}
else if (errno == EEXIST)
{
int saved_errno = errno;
/* When we get EEXIST, we need to handle the different overwrite modes. */
switch (options->overwrite_mode)
{
@ -566,6 +567,7 @@ checkout_file_hardlink (OstreeRepo *self,
else
{
g_assert_cmpint (options->overwrite_mode, ==, OSTREE_REPO_CHECKOUT_OVERWRITE_UNION_IDENTICAL);
errno = saved_errno;
return glnx_throw_errno_prefix (error, "Hardlinking %s to %s", loose_path, destination_name);
}
break;