Re: [PATCH 5/6] git_mkstemps_mode: don't set errno to EINVAL for any error.

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

 



Matthieu Moy <Matthieu.Moy@xxxxxxxxxxxxxxx> writes:

> Just removing the line would work with the current code, but this "if
> (errno <= 0) errno = EINVAL;" allows enforcing the invariant that
> errno > 0 when reaching "return -1" in a simple and reliable way (i.e.
> changing the for loop later cannot break this invariant by mistake).

I do not think "errno > 0 when -1 is returned" is a meaningful invariant.
You may return EINVAL which is positive and that may keep that invariant,
but you should not be returning that errno unless the error is "template
not ending with 6-X" to begin with, so there isn't a real gain, no?



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