[commit] r10361 - freeswitch/trunk/src/mod/applications/mod_commands
Author: mikej Date: Wed Nov 12 11:05:48 2008 New Revision: 10361 Log: MODAPP-165 time_test error checking Modified: freeswitch/trunk/src/mod/applications/mod_commands/mod_commands.c Modified: freeswitch/trunk/src/mod/applications/mod_commands/mod_commands.c ============================================================================== --- freeswitch/trunk/src/mod/applications/mod_commands/mod_commands.c (original) +++ freeswitch/trunk/src/mod/applications/mod_commands/mod_commands.c Wed Nov 12 11:05:48 2008 @@ -46,12 +46,17 @@ { switch_time_t now, then; int x; - long mss = atol(cmd); + long mss; uint32_t total = 0; int diff; int max = 10; char *p; - + if (switch_strlen_zero(cmd)){ + stream->write_function(stream, "parameter missing\n"); + return SWITCH_STATUS_SUCCESS; + } + mss = atol(cmd); + if ((p = strchr(cmd, ' '))) { max = atoi(p+1); if (max < 0) { @@ -63,7 +68,7 @@ then = switch_time_now(); switch_yield(mss); now = switch_time_now(); - diff = (int) now - then; + diff = (int) (now - then); stream->write_function(stream, "test %d sleep %ld %d\n", x+1, mss, diff); total += diff; }
participants (1)
-
FreeSWITCH SVN