[systemd-devel] [PATCH 2/3] [fd leak] Stop leaking an fd in sd_journal_sendv

Philippe De Swert philippedeswert at gmail.com
Fri Sep 12 01:39:29 PDT 2014


Hi David,

On 11/09/14 18:43, David Herrmann wrote:
> Hi
>>  _public_ int sd_journal_sendv(const struct iovec *iov, int n) {
>>          PROTECT_ERRNO;
>> -        int fd;
>> +        _cleanup_close_ int fd = -1;
> 
> This does not work. "fd" is used to hold the journal fd, but this is a
> global fd shared between all callers. See journal_fd().
> coverity might complain about this as we never close the fd. However,
> that is totally fine as it will get closed on execve() automatically.
> There is no reason to close it manually.

Good to know. I guess this goes for all journal related files then? So I
can mark them correctly in Coverity so they will not be detected wrongly
in the future.

Also thanks for applying and fixes. Will take into account your comments
about the patch rules.

Thanks,

Philippe



More information about the systemd-devel mailing list