From 11a1415fc16c0e9875229b2ec9413d5e09c32e85 Mon Sep 17 00:00:00 2001 From: Holger Hans Peter Freyther Date: Tue, 12 Jun 2012 15:48:22 +0200 Subject: syslog: Log all exit paths in this code There are some exit paths that do not have syslog logging. --- src/mgcp_ss7.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/mgcp_ss7.c b/src/mgcp_ss7.c index d323357..eae771a 100644 --- a/src/mgcp_ss7.c +++ b/src/mgcp_ss7.c @@ -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 ); -- cgit v1.2.3