Re: [cgit PATCH] Close file descriptor on error in readfile()
> The above change looks bogus. If fd == -1, you close() it anyway?
>
Ah, of course, sorry. I'll redo the patch.
Show 22 quoted lines
>> + if (fstat(fd, &st)) {
>> + close(fd);
>> return errno;
>> + }
>> if (!S_ISREG(st.st_mode))
>> return EISDIR;
>> *buf = xmalloc(st.st_size + 1);
>> *size = read_in_full(fd, *buf, st.st_size);
>> (*buf)[*size] = '\0';
>> + close(fd);
>> return (*size == st.st_size ? 0 : errno);
>> }
>> --
>> 1.6.5.2
>> --
>> To unsubscribe from this list: send the line "unsubscribe git" in
>> the body of a message to majordomo@vger.kernel.org
>> More majordomo info at http://vger.kernel.org/majordomo-info.html
>>
>>
> --
> __________ Information from ESET NOD32 Antivirus, version of virus signature database 4580 (20091106) __________
The message was checked by ESET NOD32 Antivirus.
http://www.eset.com