X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;f=src%2Frmr%2Fsi%2Fsrc%2Fsi95%2Fsiinit.c;h=0eaadb6355c209c5ed58d6efffab88aa70638440;hb=fa454008020483ac35e1d20300cddfe877d8dd6d;hp=b297124b8b0ae6c9b365debc38fd8e3e7cf5708e;hpb=a00e2ad464d72d097d4272cecd8d6fe7da93fb64;p=ric-plt%2Flib%2Frmr.git diff --git a/src/rmr/si/src/si95/siinit.c b/src/rmr/si/src/si95/siinit.c index b297124..0eaadb6 100644 --- a/src/rmr/si/src/si95/siinit.c +++ b/src/rmr/si/src/si95/siinit.c @@ -22,16 +22,16 @@ ************************************************************************** * Mnemonic: SIinitialise * Abstract: Initialisation and other context management functions. -* +* * Date: 26 March 1995 * Author: E. Scott Daniels * -* Mod: 17 FEB 2002 - To convert to a globally managed gpointer -* 09 Mar 2007 - To allow for ipv6 (added SIinitialise() to +* Mod: 17 FEB 2002 - To convert to a globally managed gpointer +* 09 Mar 2007 - To allow for ipv6 (added SIinitialise() to * replace SIinit()) ************************************************************************** */ -#include "sisetup.h" // get the setup stuff +#include "sisetup.h" // get the setup stuff /* Initialise the SI environment. Specifically: @@ -42,12 +42,12 @@ */ extern struct ginfo_blk* SIinitialise( int opts ) { - struct ginfo_blk *gptr = NULL; // pointer at gen info blk - int status = SI_OK; // status of internal processing - struct tp_blk *tpptr; // pointer at tp stuff - struct sigaction sact; // signal action block - int i; // loop index - int signals = SI_DEF_SIGS; // signals to be set in SIsetsig + struct ginfo_blk *gptr = NULL; // pointer at gen info blk + int status = SI_OK; // status of internal processing + struct tp_blk *tpptr; // pointer at tp stuff + struct sigaction sact; // signal action block + int i; // loop index + int signals = SI_DEF_SIGS; // signals to be set in SIsetsig errno = ENOMEM; @@ -65,24 +65,25 @@ extern struct ginfo_blk* SIinitialise( int opts ) gptr->cbtab = (struct callback_blk *) malloc( (sizeof( struct callback_blk ) * MAX_CBS ) ); if( gptr->cbtab != NULL ) { - for( i = 0; i < MAX_CBS; i++ ) { // initialize callback table - gptr->cbtab[i].cbdata = NULL; // no data and no functions + for( i = 0; i < MAX_CBS; i++ ) { // initialize callback table + gptr->cbtab[i].cbdata = NULL; // no data and no functions gptr->cbtab[i].cbrtn = NULL; } - } else { // if call back table allocation failed - error off - SIshutdown( gptr ); // clean up any open fds + } else { // if call back table allocation failed - error off + SIshutdown( gptr ); // clean up any open fds + free( gptr->tp_map ); free( gptr ); - gptr = NULL; // dont allow them to continue + gptr = NULL; // dont allow them to continue } - } // end if gen infor block allocated successfully + } // end if gen infor block allocated successfully + - memset( &sact, 0, sizeof( sact ) ); sact.sa_handler = SIG_IGN; sigaction( SIGPIPE, &sact, NULL ); // ignore pipe signals as for some bloody reason linux sets this off if write to closed socket - return gptr; // all's well that ends well -} + return gptr; // all's well that ends well +} /* This will set all of the tcp oriented flags in mask (SI_TF_* constants).