From: Sami Kerola Date: Mon, 22 Aug 2016 21:40:50 +0000 (+0100) Subject: warnings: fix use of uninitialized warning X-Git-Tag: v0.88~26^2~38 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ec9dcfa4c86d926bcc0f2ca08b1a2d5d45463dc2;p=thirdparty%2Fmtr.git warnings: fix use of uninitialized warning clang claims: variable 'port' is used uninitialized whenever switch default is taken. And that is a lie, but error() is not marked as function that never returns, because it can also be used when printing warning. So the compiler is guessing wrong, but the easiest fix is to initialize the variable rather than educate compiler. --- diff --git a/net.c b/net.c index 68ed736..34df68f 100644 --- a/net.c +++ b/net.c @@ -329,7 +329,7 @@ static int new_sequence(int index) static void net_send_tcp(int index) { int ttl, s; - int port; + int port = 0; int flags; struct sockaddr_storage local; struct sockaddr_storage remote; @@ -449,7 +449,7 @@ static void net_send_sctp(int index) { int ttl, s; int opt = 1; - int port; + int port = 0; struct sockaddr_storage local; struct sockaddr_storage remote; struct sockaddr_in *local4 = (struct sockaddr_in *) &local;