Re: [PATCH 1/2] git_mkstemps: correctly test return value of open()

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

 



Junio C Hamano <gitster@xxxxxxxxx> writes:

> Drew Northup <n1xim.email@xxxxxxxxx> writes:
>
>> I presume that I should apply this change to my porting of
>> git_mkstemps_mode() to tig. If there are no complaints about this for
>> a couple of days I will do so.
>
> Hmph, Thomas and I were actually asking you to give us
>
> 	Signed-off-by: Drew Northup <n1xim.email@xxxxxxxxx>

Gaahhh, I need a bit more caffeine.  Somehow I mixed up Dale and
Drew.

Sorry for the noise.  Please ignore.


> for the patch in question.  If tig has the same issue, applying that
> same patch there may make sense, but that is an independent issue.
>
> Thanks.
>
>>
>> REF: $gmane/229961
>>
>> On 07/17/2013 03:29 PM, Junio C Hamano wrote:
>>> Thomas Rast<trast@xxxxxxxxxxx>  writes:
>>>> Thomas Rast<trast@xxxxxxxxxxx>  writes:
>>>>> From: "Dale R. Worley"<worley@xxxxxxxxxxxx>
>>>>>
>>>>> open() returns -1 on failure, and indeed 0 is a possible success value
>>>>> if the user closed stdin in our process.  Fix the test.
>>>>>
>>>>> Signed-off-by: Thomas Rast<trast@xxxxxxxxxxx>
>>
>>>>>   wrapper.c | 2 +-
>>>>>   1 file changed, 1 insertion(+), 1 deletion(-)
>>>>>
>>>>> diff --git a/wrapper.c b/wrapper.c
>>>>> index dd7ecbb..6a015de 100644
>>>>> --- a/wrapper.c
>>>>> +++ b/wrapper.c
>>>>> @@ -322,7 +322,7 @@ int git_mkstemps_mode(char *pattern, int suffix_len, int mode)
>>>>>   		template[5] = letters[v % num_letters]; v /= num_letters;
>>>>>
>>>>>   		fd = open(pattern, O_CREAT | O_EXCL | O_RDWR, mode);
>>>>> -		if (fd>  0)
>>>>> +		if (fd>= 0)
>>>>>   			return fd;
>>>>>   		/*
>>>>>   		 * Fatal error (EPERM, ENOSPC etc).
>>
>>
>> --
>> -Drew Northup
>> --------------------------------------------------------------
>> "As opposed to vegetable or mineral error?"
>> -John Pescatore, SANS NewsBites Vol. 12 Num. 59
--
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]