All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH lksctp-tools 2/9] peel_client: fix covscan warnings
@ 2018-07-31  8:53 Xin Long
  0 siblings, 0 replies; only message in thread
From: Xin Long @ 2018-07-31  8:53 UTC (permalink / raw)
  To: linux-sctp

initialize msg.msg_flags and event, and check 'select' returned value
in peel_client.

Signed-off-by: Xin Long <lucien.xin@gmail.com>
---
 src/apps/peel_client.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/src/apps/peel_client.c b/src/apps/peel_client.c
index f604349..5c195d3 100644
--- a/src/apps/peel_client.c
+++ b/src/apps/peel_client.c
@@ -446,6 +446,7 @@ my_sctpReadInput(int fd)
 	msg.msg_iovlen = 1;
 	msg.msg_control = (caddr_t)controlVector;
 	msg.msg_controllen = sizeof(controlVector);
+	msg.msg_flags = 0;
 	errno = 0;
 	sz = recvmsg(fd,&msg,0);
 	if(sz <= 0){
@@ -483,7 +484,8 @@ clear_fds(int fd,int fd1)
 	}
 	notdone = 1;
 	while(notdone){
-		select(max,&readfds,&writefds,&exceptfds,&tv);
+		if (select(max, &readfds, &writefds, &exceptfds, &tv) = -1)
+			break;
 		notdone = 0;
 		if(FD_ISSET(fd,&readfds)){
 			notdone++;
@@ -553,7 +555,7 @@ main(int argc, char **argv)
 	char *addr=NULL;
 	uint16_t port=0;
 	int protocol_touse = IPPROTO_SCTP;
-	struct sctp_event_subscribe event;
+	struct sctp_event_subscribe event = {0};
 
 	while((i= getopt(argc,argv,"p:h:")) != EOF){
 		switch(i){
-- 
2.1.0


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2018-07-31  8:53 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-07-31  8:53 [PATCH lksctp-tools 2/9] peel_client: fix covscan warnings Xin Long

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.