osasnmpd: remove unused code, improve readability

Remove unused code because query_OSA_EXP does actually never return -1.
So make its return value unsigned and remove all checks for negative
return values.

Signed-off-by: Karsten Graul <kgraul@linux.ibm.com>
Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
This commit is contained in:
Karsten Graul
2018-10-19 13:17:06 +02:00
committed by Jan Höppner
parent 66ed1727f9
commit ff2a403bd2
3 changed files with 4 additions and 24 deletions

View File

@@ -85,15 +85,7 @@ void init_ibmOSAMib(void) {
/* query OSA-E device driver for OSA-E devices and mark them in IF-MIB interface list */
osaexp_num = query_OSA_EXP ( &if_list, ifNumber );
if ( osaexp_num < 0 )
{
fprintf( stderr, "init_ibmOSAMib(): "
"OSA-E device driver query interface ioctl() failed\n"
"check agent log file for more details\n"
"Cannot start subagent...exiting...\n");
exit(1);
}
else if ( osaexp_num == 0 )
if ( osaexp_num == 0 )
{
get_time( time_buf );
snmp_log( LOG_ERR, "%s init_ibmOSAMib(): none of the %d interfaces is a real "

View File

@@ -1204,18 +1204,7 @@ void update_mib_info ()
* and mark them in IF-MIB interface list
* */
osaexp_num = query_OSA_EXP( &tmp_list, if_num );
if ( osaexp_num < 0 )
{
get_time( time_buf );
fprintf( stderr, "%s update_mib_info(): "
"OSA-E device driver query interface ioctl() "
"failed\nupdate_mib_info(): going to stop osasnmpd daemon\n"
"update_mib_info(): check subagent logfile for more details\n"
"update_mib_info(): sending termination signal to osasnmpd...\n",
time_buf );
exit(-1);
}
else if ( osaexp_num == 0 )
if ( osaexp_num == 0 )
{
get_time( time_buf );
snmp_log( LOG_ERR, "%s update_mib_info(): "
@@ -1698,9 +1687,8 @@ int query_IF_MIB ( IF_LIST** ifList )
* IN int if_Number: number of network interfaces
* returns: int num - number of OSA Express devices found on this
* system (>=0)
* -1 -an error occurred , no valid info avail
*********************************************************************/
int query_OSA_EXP ( IF_LIST** ifList, int if_Number )
unsigned int query_OSA_EXP ( IF_LIST** ifList, int if_Number )
{
int j, num = 0;
char time_buf[TIME_BUF_SIZE]; /* date/time buffer */

View File

@@ -91,7 +91,7 @@ void update_mib_info ( );
int query_IF_MIB( IF_LIST** );
/* retrieves OSA Express interface information from kernel */
int query_OSA_EXP ( IF_LIST** ,int );
unsigned int query_OSA_EXP ( IF_LIST** ,int );
/* get time of day */
int get_time( char* );