Re: [PATCH v9 03/41] builtin/apply: make apply_patch() return -1 or -128 instead of die()ing

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

 



On Sat, Jul 30, 2016 at 10:24 AM, Christian Couder
<christian.couder@xxxxxxxxx> wrote:

> + * Try to apply a patch.
> + *
> + * Returns:
> + *  -128 if a bad error happened (like patch unreadable)
> + *  -1 if patch did not apply and user cannot deal with it
> + *   0 if the patch applied
> + *   1 if the patch did not apply but user might fix it

I stopped and wondered when reading this comment,
what the difference between -1 and 1 is, as the user is
not part of this function.

When reading the code, this makes sense, though.
So -1 is returned when the user set `apply_with_reject`,
1 otherwise? So the user told us upfront how to deal with
certain errors.

What is a "bad" error, that generates a -128?
(Only when the patch is not syntactically correct? Or are there
other -128 errors as well?)

Maybe:
 Returns zero on success,
 non zero for failing to apply a patch
 negative values for hard errors, e.g. unreadable patc.

Though this is less precise, as it doesn't differentiate between
-1 and -128. I dunno.

(These are just musings that should not stop going
forward with this patch, just some thoughts on the precision
of a comment)

Thanks,
Stefan
--
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]