summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorColin Walters <walters@verbum.org>2021-08-26 15:16:37 -0400
committerColin Walters <walters@verbum.org>2021-08-26 15:17:36 -0400
commit87d115706eed52069e54785b87108c97a44a0343 (patch)
tree15d417907a36a408bf4ed49547803ecd18d85f1e
parent28a079291910d9772fc3b19820d0cb0d946c095f (diff)
downloadostree-87d115706eed52069e54785b87108c97a44a0343.tar.gz
checkout: Save errno when re-throwing
I was seeing an `EPERM` here which was confusing. It turned out the real error was `EEXIST`. Since we're referring to the original error, but we do a lot of computation in the middle, we need to save errno.
-rw-r--r--src/libostree/ostree-repo-checkout.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/libostree/ostree-repo-checkout.c b/src/libostree/ostree-repo-checkout.c
index eaa33a28..bdd93e7c 100644
--- a/src/libostree/ostree-repo-checkout.c
+++ b/src/libostree/ostree-repo-checkout.c
@@ -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;