[asterisk-commits] russell: trunk r87233 - in /trunk/funcs: func_lock.c func_shell.c
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Fri Oct 26 20:15:02 CDT 2007
Author: russell
Date: Fri Oct 26 20:15:02 2007
New Revision: 87233
URL: http://svn.digium.com/view/asterisk?view=rev&rev=87233
Log:
Make sure a channel exists before attempting to start or stop channel
autoservice in func_lock and func_shell.
Modified:
trunk/funcs/func_lock.c
trunk/funcs/func_shell.c
Modified: trunk/funcs/func_lock.c
URL: http://svn.digium.com/view/asterisk/trunk/funcs/func_lock.c?view=diff&rev=87233&r1=87232&r2=87233
==============================================================================
--- trunk/funcs/func_lock.c (original)
+++ trunk/funcs/func_lock.c Fri Oct 26 20:15:02 2007
@@ -256,19 +256,27 @@
}
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;
}
Modified: trunk/funcs/func_shell.c
URL: http://svn.digium.com/view/asterisk/trunk/funcs/func_shell.c?view=diff&rev=87233&r1=87232&r2=87233
==============================================================================
--- trunk/funcs/func_shell.c (original)
+++ trunk/funcs/func_shell.c Fri Oct 26 20:15:02 2007
@@ -49,7 +49,8 @@
return -1;
}
- ast_autoservice_start(chan);
+ if (chan)
+ ast_autoservice_start(chan);
if (len >= 1) {
FILE *ptr;
@@ -62,7 +63,8 @@
pclose(ptr);
}
- ast_autoservice_stop(chan);
+ if (chan)
+ ast_autoservice_stop(chan);
return 0;
}
More information about the asterisk-commits
mailing list