From: Anthony Minessale Date: Mon, 22 Sep 2008 21:53:50 +0000 (+0000) Subject: fix negative number in printf X-Git-Tag: v1.0.2~1161 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=22467e38d6f3fefa541f0c1a44d1a230d1a803f5;p=thirdparty%2Ffreeswitch.git fix negative number in printf git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@9620 d0543943-73ff-0310-b7d9-9358b9ac24b2 --- diff --git a/src/mod/endpoints/mod_sofia/mod_sofia.c b/src/mod/endpoints/mod_sofia/mod_sofia.c index 09b9422208..b66f73edbc 100644 --- a/src/mod/endpoints/mod_sofia/mod_sofia.c +++ b/src/mod/endpoints/mod_sofia/mod_sofia.c @@ -1376,7 +1376,12 @@ static switch_status_t cmd_status(char **argv, int argc, switch_stream_handle_t switch_assert(gp->state < REG_STATE_LAST); stream->write_function(stream, "%25s\t%s\t %32s\t%s", gp->name, "gateway", gp->register_to, sofia_state_names[gp->state]); if (gp->state == REG_STATE_FAILED || gp->state == REG_STATE_TRYING) { - stream->write_function(stream, " (retry: %ds)", gp->retry - switch_timestamp(NULL)); + time_t now = switch_timestamp(NULL); + if (gp->retry > now) { + stream->write_function(stream, " (retry: %ds)", gp->retry - now); + } else { + stream->write_function(stream, " (retry: NEVER)"); + } } stream->write_function(stream, "\n"); }