Re: [PATCH v8 22/44] fetch.c: clear errno before calling functions that might set it

2014-05-16 Thread Jonathan Nieder
(cc-ing peff, who may remember this STORE_REF_ERROR_DF_CONFLICT case from long ago) Ronnie Sahlberg wrote: In s_update_ref there are two calls that when they fail we return an error based on the errno value. In particular we want to return a specific error if ENOTDIR happened. Both these

Re: [PATCH v8 22/44] fetch.c: clear errno before calling functions that might set it

2014-05-16 Thread Ronnie Sahlberg
errno is hairy :-( You probably also want something like this : diff --git a/builtin/fetch.c b/builtin/fetch.c index 4603cb6..55e7dd8 100644 --- a/builtin/fetch.c +++ b/builtin/fetch.c @@ -426,7 +426,7 @@ static int update_local_ref(struct ref *ref, _(! %-*s %-*s - %s

Re: [PATCH v8 22/44] fetch.c: clear errno before calling functions that might set it

2014-05-16 Thread Jeff King
On Fri, May 16, 2014 at 11:33:48AM -0700, Jonathan Nieder wrote: (cc-ing peff, who may remember this STORE_REF_ERROR_DF_CONFLICT case from long ago) No, but I have very good tools for searching the list archive. ;) In s_update_ref there are two calls that when they fail we return an error

[PATCH v8 22/44] fetch.c: clear errno before calling functions that might set it

2014-05-15 Thread Ronnie Sahlberg
In s_update_ref there are two calls that when they fail we return an error based on the errno value. In particular we want to return a specific error if ENOTDIR happened. Both these functions do have failure modes where they may return an error without updating errno, in which case a previous and