Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/refs.c
diff options
context:
space:
mode:
authorÆvar Arnfjörð Bjarmason <avarab@gmail.com>2021-10-16 12:39:25 +0300
committerJunio C Hamano <gitster@pobox.com>2021-10-16 21:17:04 +0300
commit4755d7dff7a27f431493926541fd6aab2e860aa4 (patch)
treec52402defe76bb6b25bc7fe755040d1135c7701c /refs.c
parent6582bd31e3f3fa6cfb16fae0cd31036081c14a0a (diff)
refs API: don't expose "errno" in run_transaction_hook()
In run_transaction_hook() we've checked errno since 67541597670 (refs: implement reference transaction hook, 2020-06-19), let's reset errno afterwards to make sure nobody using refs.c directly or indirectly relies on it. Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'refs.c')
-rw-r--r--refs.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/refs.c b/refs.c
index 43fe9e6d89d..e90c59539b4 100644
--- a/refs.c
+++ b/refs.c
@@ -2096,8 +2096,11 @@ static int run_transaction_hook(struct ref_transaction *transaction,
update->refname);
if (write_in_full(proc.in, buf.buf, buf.len) < 0) {
- if (errno != EPIPE)
+ if (errno != EPIPE) {
+ /* Don't leak errno outside this API */
+ errno = 0;
ret = -1;
+ }
break;
}
}