Fixed a core dump with signed/unsigned and an error in converting from

subsystem text to subsystem number

This version compiles and runs under rhel7
This commit is contained in:
2017-01-17 13:53:10 +01:00
parent 7fc58190ae
commit 0a76081bbb
2 changed files with 3 additions and 3 deletions

View File

@ -221,7 +221,7 @@ int subsystemFromText(const char *text)
return i; return i;
} }
} }
return -1; return SINVALID;
} }
/*----------------------------------------------------------------------------*/ /*----------------------------------------------------------------------------*/
void formatSubsystem(unsigned int sub, char *buffer, unsigned int bufferLength) void formatSubsystem(unsigned int sub, char *buffer, unsigned int bufferLength)
@ -265,7 +265,7 @@ unsigned int logFilter(unsigned int severity, const char *subsystem, const char
If it is in the list of enabled subsystems, everything is logged If it is in the list of enabled subsystems, everything is logged
*/ */
sub = subsystemFromText(subsystem); sub = subsystemFromText(subsystem);
if(sub >= 0 && severity <= logEnabledArray[sub]){ if((sub >= 0 && sub <= SINVALID) && severity <= logEnabledArray[sub]){
return 0; return 0;
} }

View File

@ -38,7 +38,7 @@
#define SHISTORY 7 #define SHISTORY 7
#define SINVALID 8 #define SINVALID 8
#define MAXSUB 7 #define MAXSUB 8
/* write a log message /* write a log message