Re: [PATCH] refs: print errno for read_raw_ref if GIT_TRACE_REFS is set

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



"Han-Wen Nienhuys via GitGitGadget" <gitgitgadget@xxxxxxxxx> writes:

> diff --git a/refs/debug.c b/refs/debug.c
> index 922e64fa6ad9..576bf98e74ae 100644
> --- a/refs/debug.c
> +++ b/refs/debug.c
> @@ -244,6 +244,7 @@ static int debug_read_raw_ref(struct ref_store *ref_store, const char *refname,
>  	int res = 0;
>  
>  	oidcpy(oid, &null_oid);
> +	errno = 0;
>  	res = drefs->refs->be->read_raw_ref(drefs->refs, refname, oid, referent,
>  					    type);
>  
> @@ -251,7 +252,9 @@ static int debug_read_raw_ref(struct ref_store *ref_store, const char *refname,
>  		trace_printf_key(&trace_refs, "read_raw_ref: %s: %s (=> %s) type %x: %d\n",
>  			refname, oid_to_hex(oid), referent->buf, *type, res);
>  	} else {
> -		trace_printf_key(&trace_refs, "read_raw_ref: %s: %d\n", refname, res);
> +		trace_printf_key(&trace_refs,
> +				 "read_raw_ref: %s: %d (errno %d)\n", refname,
> +				 res, errno);
>  	}

OK.  Between trace_printf_key() and the return of the call to
read_raw_ref() method of the ref backend is only an "if (res == 0)"
condition and I do not see anything that might clobber errno.

I do wonder if we want strerror(errno) instead of the number, but I
can go either way (it's just a trace output).

Thanks, will queue.



[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux