9
0
Fork 0

syslog: Log all exit paths in this code

There are some exit paths that do not have syslog logging.
This commit is contained in:
Holger Hans Peter Freyther 2012-06-12 15:48:22 +02:00
parent 826390a5ba
commit 11a1415fc1
1 changed files with 7 additions and 6 deletions

View File

@ -87,10 +87,11 @@ static int select_voice_port(struct mgcp_endpoint *endp)
return mgw_port;
}
static void check_exit(int status)
static void check_exit(const char *text, int status)
{
if (exit_on_failure && status == 21) {
LOGP(DMGCP, LOGL_ERROR, "Failure detected with the MGW. Exiting.\n");
LOGP(DMGCP, LOGL_ERROR, "Failure detected with the MGW. Exiting: '%s'\n", text);
syslog(LOG_ERR, "Failure detected with the MGW. Exititng: '%s'\n", text);
exit(-1);
}
}
@ -207,7 +208,7 @@ static int uniporte_events(unsigned long port, EventTypeT event,
sprintf(text, "Object %d value %d status %d", info->object, info->value,
info->status );
puts(text);
check_exit(info->status);
check_exit(text, info->status);
}
else if ( ( event == Event_USER_MOB_SET_COMPLETE ) ||
( event == Event_USER_MOB_DEFINE_COMPLETE ) )
@ -216,7 +217,7 @@ static int uniporte_events(unsigned long port, EventTypeT event,
sprintf( text, "Mob ID %d status %d", info->MOBId, info->status );
puts(text);
check_exit(info->status);
check_exit(text, info->status);
}
else if ( event == Event_USER_MOB_GET_COMPLETE )
{
@ -224,7 +225,7 @@ static int uniporte_events(unsigned long port, EventTypeT event,
sprintf( text, "Mob ID %d status %d", info->MOBId, info->status );
puts(text);
check_exit(info->status);
check_exit(text, info->status);
}
else if (event == Event_CONNECT)
{
@ -236,7 +237,7 @@ static int uniporte_events(unsigned long port, EventTypeT event,
sprintf(text, "Mob ID %d status %d", info->MOBId, info->status );
puts(text);
check_exit(info->status);
check_exit(text, info->status);
}
return( 0 );