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 | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/trinity.c b/trinity.c
index 93e7819..32717c0 100644
--- a/trinity.c
+++ b/trinity.c
@@ -249,7 +249,7 @@ int main(int argc, char* argv[])
 cleanup_fds:
 
        for (i = 0; i < nr_sockets; i++) {
-               struct linger ling;
+               struct linger ling = { .l_onoff = FALSE, };
 
                ling.l_onoff = FALSE;   /* linger active */
                setsockopt(shm->socket_fds[i], SOL_SOCKET, SO_LINGER, &ling, 
sizeof(struct linger));
-- 
1.8.3.1

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

Reply via email to