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;