From c4aa3c0eb4f5717856dc3811c92c14078474c959 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Mon, 8 May 2017 14:01:56 -0500 Subject: [PATCH] FS-10291: [fs_cli] fs_cli Error indicated on console loglevel debug with extra whitespace before or after debug #resolve --- .../mod_event_socket/mod_event_socket.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/mod/event_handlers/mod_event_socket/mod_event_socket.c b/src/mod/event_handlers/mod_event_socket/mod_event_socket.c index e441fd6cc4..17d057c8d7 100644 --- a/src/mod/event_handlers/mod_event_socket/mod_event_socket.c +++ b/src/mod/event_handlers/mod_event_socket/mod_event_socket.c @@ -2382,7 +2382,7 @@ static switch_status_t parse_command(listener_t *listener, switch_event_t **even goto done_noreply; } else if (!strncasecmp(cmd, "log", 3)) { - char *level_s; + char *level_s, *p; switch_log_level_t ltype = SWITCH_LOG_DEBUG; if (!switch_test_flag(listener, LFLAG_ALLOW_LOG)) { @@ -2395,11 +2395,14 @@ static switch_status_t parse_command(listener_t *listener, switch_event_t **even //move past the command level_s = cmd + 3; - //see if we got an argument - if (!zstr(level_s)) { - //if so move to the argument + while(*level_s == ' ') { level_s++; } + + if ((p = strchr(level_s, ' '))) { + *p = '\0'; + } + //see if we lined up on an argument or not if (!zstr(level_s)) { ltype = switch_log_str2level(level_s);