* [PATCH lksctp-tools 3/9] peel_server: 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
check the select and listen returned value, and initialize event.
Signed-off-by: Xin Long <lucien.xin@gmail.com>
---
src/apps/peel_server.c | 11 ++++++++---
1 file changed, 8 insertions(+), 3 deletions(-)
diff --git a/src/apps/peel_server.c b/src/apps/peel_server.c
index 88545b4..24a1ef8 100644
--- a/src/apps/peel_server.c
+++ b/src/apps/peel_server.c
@@ -466,7 +466,8 @@ poll_fd(int fd)
printf("poll_fd\n");
FD_SET(fd,&readfds);
- select(max,&readfds,&writefds,&exceptfds,NULL);
+ if (select(max, &readfds, &writefds, &exceptfds, NULL) = -1)
+ return(cameup);
if(FD_ISSET(fd,&readfds)){
printf("Read please\n");
cameup += my_sctpReadInput(fd,4100);
@@ -605,7 +606,7 @@ main(int argc, char **argv)
int i,fd;
uint16_t myport=0;
int magic=0;
- struct sctp_event_subscribe event;
+ struct sctp_event_subscribe event = {0};
while((i= getopt(argc,argv,"m:M:")) != EOF){
switch(i){
case 'm':
@@ -639,7 +640,11 @@ main(int argc, char **argv)
return(-1);
}
printf("fd uses port %d\n",ntohs(got.sin_port));
- listen(fd,100);
+ if (listen(fd, 100) = -1) {
+ printf("listen err: %d\n", errno);
+ close(fd);
+ return(-1);
+ }
/* enable all event notifications */
event.sctp_data_io_event = 1;
event.sctp_association_event = 1;
--
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 3/9] peel_server: fix covscan warnings Xin Long
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).