On Wed, Nov 19, 2014 at 10:14:17AM -0800, Junio C Hamano wrote:
> >> What the above doesn't explain is why the caller cares about errno.
> >> Are they going to print another message with strerror(errno)? Or are
> >> they going to consider some errors non-errors (like ENOENT when trying
> >> to un
Jeff King writes:
> On Tue, Nov 18, 2014 at 05:43:44PM -0800, Jonathan Nieder wrote:
>
>> Jeff King wrote:
>>
>> > It's common to use error() to return from a function, like:
>> >
>> >if (open(...) < 0)
>> >return error("open failed");
>> >
>> > Unfortunately this may clobber the
On Tue, Nov 18, 2014 at 05:43:44PM -0800, Jonathan Nieder wrote:
> Jeff King wrote:
>
> > It's common to use error() to return from a function, like:
> >
> > if (open(...) < 0)
> > return error("open failed");
> >
> > Unfortunately this may clobber the errno from the open()
> > ca
Jeff King wrote:
> It's common to use error() to return from a function, like:
>
> if (open(...) < 0)
> return error("open failed");
>
> Unfortunately this may clobber the errno from the open()
> call. So we often end up with code like this:
>
> if (open(...) < 0) {
>
This one makes my day.
A really good fix as it minimizes maintenance burden for checking
incoming patches for that pattern.
Reviewed-by: Stefan Beller
On Tue, Nov 18, 2014 at 5:37 PM, Jeff King wrote:
> It's common to use error() to return from a function, like:
>
> if (open(...) < 0)
5 matches
Mail list logo