On Thu, Jul 04, 2013 at 10:55:39PM +0300, Mikko Rapeli wrote:
> Coverity says:
>
> CID 1042350 (#1 of 1): Uninitialized scalar variable (UNINIT)
> 23. uninit_use_in_call: Using uninitialized value "ling": field
> "ling"."l_linger" is uninitialized when calling "setsockopt(int, int, int,
> void const *, socklen_t)".
>
> Signed-off-by: Mikko Rapeli <[email protected]>
> ---
> trinity.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/trinity.c b/trinity.c
> index 93e7819..3f80020 100644
> --- a/trinity.c
> +++ b/trinity.c
> @@ -250,6 +250,7 @@ cleanup_fds:
>
> for (i = 0; i < nr_sockets; i++) {
> struct linger ling;
> + memset(&ling, 0, sizeof(ling));
>
> ling.l_onoff = FALSE; /* linger active */
> setsockopt(shm->socket_fds[i], SOL_SOCKET, SO_LINGER, &ling,
> sizeof(struct linger));
Let's just do this as
struct linger ling = { .l_onoff = FALSE, };
That should have the same effect.
This should be a harmless bug anyway, because l_linger only matters when we're
turning
linger on afaik.
Dave
--
To unsubscribe from this list: send the line "unsubscribe trinity" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html