Skip to content
Snippets Groups Projects
Commit 024bd672 authored by Russell Bryant's avatar Russell Bryant
Browse files

Make sure a channel exists before attempting to start or stop channel

autoservice in func_lock and func_shell.


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@87233 65c4cc65-6c06-0410-ace0-fbb531ad65f3
parent db88298c
No related branches found
No related tags found
No related merge requests found
......@@ -256,19 +256,27 @@ static int unlock_read(struct ast_channel *chan, const char *cmd, char *data, ch
}
static int lock_read(struct ast_channel *chan, const char *cmd, char *data, char *buf, size_t len)
{
ast_autoservice_start(chan);
{
if (chan)
ast_autoservice_start(chan);
ast_copy_string(buf, get_lock(chan, data, 0) ? "0" : "1", len);
ast_autoservice_stop(chan);
if (chan)
ast_autoservice_stop(chan);
return 0;
}
static int trylock_read(struct ast_channel *chan, const char *cmd, char *data, char *buf, size_t len)
{
ast_autoservice_start(chan);
if (chan)
ast_autoservice_start(chan);
ast_copy_string(buf, get_lock(chan, data, 1) ? "0" : "1", len);
ast_autoservice_stop(chan);
if (chan)
ast_autoservice_stop(chan);
return 0;
}
......
......@@ -49,7 +49,8 @@ static int shell_helper(struct ast_channel *chan, const char *cmd, char *data,
return -1;
}
ast_autoservice_start(chan);
if (chan)
ast_autoservice_start(chan);
if (len >= 1) {
FILE *ptr;
......@@ -62,7 +63,8 @@ static int shell_helper(struct ast_channel *chan, const char *cmd, char *data,
pclose(ptr);
}
ast_autoservice_stop(chan);
if (chan)
ast_autoservice_stop(chan);
return 0;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment