Re: [PATCH] builtin/apply: exit when parse_binary() fails

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

 



On Wed, Mar 16, 2016 at 8:44 PM, Junio C Hamano <gitster@xxxxxxxxx> wrote:
> Christian Couder <christian.couder@xxxxxxxxx> writes:
>
>> In parse_binary() there is:
>>
>>       forward = parse_binary_hunk(&buffer, &size, &status, &used);
>>       if (!forward && !status)
>>               /* there has to be one hunk (forward hunk) */
>>               return error(_("unrecognized binary patch at line %d"), linenr-1);
>>
>> so parse_binary() can return -1, because that's what error() returns.
>>
>> Also parse_binary_hunk() sets "status" to -1 in case of error and
>> parse_binary() does "if (status) return status;".
>
> All of the above sounds sensible, and your follow-up patch expects
> parse_chunk() to return -1 on failure--it is a bit sad that you make
> parse_chunk() to directly call exit(2).  In the spirit of eventually
> libifying this codepath, shouldn't we be turning existing die() to
> an error return, instead of introducing more calls to exit(2)?

Yeah, I found these little bugs when working on libifying these
functions. So I agree that it is sad to introduce an exit() call now
and I am ok to make parse_chunk() return -1 instead.

I will resend with that change.

Thanks,
Christian.
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[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]