Hi

On Wed, Sep 10, 2014 at 9:14 PM,  <philippedesw...@gmail.com> wrote:
> From: Philippe De Swert <philippedesw...@gmail.com>
>
> Found with Coverity. Fixes: CID#996435
>
> Signed-off-by: Philippe De Swert <philippedesw...@gmail.com>
> ---
>  src/journal/journal-send.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/src/journal/journal-send.c b/src/journal/journal-send.c
> index bb1ef66..b7cc4bd 100644
> --- a/src/journal/journal-send.c
> +++ b/src/journal/journal-send.c
> @@ -198,7 +198,7 @@ finish:
>
>  _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.

Thanks
David

>          _cleanup_close_ int buffer_fd = -1;
>          struct iovec *w;
>          uint64_t *l;
> --
> 1.8.3.2
>
> _______________________________________________
> systemd-devel mailing list
> systemd-devel@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/systemd-devel
_______________________________________________
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel

Reply via email to