// vim: noet sw=4 ts=4:
/*
==================================================================================
- Copyright (c) 2020 Nokia
- Copyright (c) 2020 AT&T Intellectual Property.
+ Copyright (c) 2020-2021 Nokia
+ Copyright (c) 2020-2021 AT&T Intellectual Property.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
extern int SIpoll( struct ginfo_blk *gptr, int msdelay )
{
- //extern int deaths; // number of children that died and are zombies
- //extern int sigflags; // flags set by the signal handler routine
-
int fd; // file descriptor for use in this routine
int ((*cbptr)()); // pointer to callback routine to call
int status = SI_OK; // return status
- int addrlen; // length of address from recvfrom call
- char *buf; // work buffer pointer
+ int addrlen = 0; // length of address from recvfrom call
+ char *buf; // work buffer pointer
char ibuf[1025];
int i; // loop index
struct tp_blk *tpptr; // pointer at tp stuff
pstat = select( gptr->fdcount, &gptr->readfds, &gptr->writefds,
&gptr->execpfds, &delay );
- if( (pstat < 0 && errno != EINTR) )
+ if( pstat < 0 && errno != EINTR )
{ // poll fail or termination signal rcvd
gptr->fdcount = 0; // prevent trying to look at a session
gptr->flags |= GIF_SHUTDOWN; // cause cleanup and exit at end
if( tpptr->flags & TPF_LISTENFD ) // listen port setup by init?
{ // yes-assume new session req
- status = SInewsession( gptr, tpptr ); // make new session
+ SInewsession( gptr, tpptr ); // cannot do anything about failure, so ignore status
}
else // data received on a regular port
if( tpptr->type == SOCK_DGRAM ) // udp socket?
status = (*cbptr)( gptr->cbtab[SI_CB_RDATA].cbdata, gptr->rbuf, status, buf );
SIcbstat( gptr, status, SI_CB_RDATA ); // handle status
free( buf );
+ buf = NULL; // just to be safe
} // end if call back was defined
} // end if status was ok
free( uaddr );