Re: [PATCH v5 1/5] setup: add gentle version of read_gitfile

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

 



Stefan Beller <sbeller@xxxxxxxxxx> writes:

[administrivia: cull the parts of the original from your quote if
you are not addressing them]

>>         fd = open(path, O_RDONLY);
>> -       if (fd < 0)
>> -               die_errno("Error opening '%s'", path);
>> +       if (fd < 0) {
>> +               error_code = READ_GITFILE_ERR_OPEN_FAILED;
>> +               goto cleanup_return;
>> +       }
>>         buf = xmalloc(st.st_size + 1);
>>         len = read_in_full(fd, buf, st.st_size);
>>         close(fd);
>> -       if (len != st.st_size)
>> -               die("Error reading %s", path);
>> +       if (len != st.st_size) {
>> +               error_code = READ_GITFILE_ERR_READ_FAILED;
>> +               goto cleanup_return;
>
> Sorry for the late review.
>
> So when you jump from here to the cleanup, there is no close(fd) involved?
> I think there are code paths now, which leak fd.

This one comes _after_ close(fd), so there is no issue.

A later step does introduce an issue; see $gmane/267975.

Thanks.


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