Few more code clean ups.

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@54534 65c4cc65-6c06-0410-ace0-fbb531ad65f3
1.6.0
Joshua Colp 19 years ago
parent fd3630715b
commit db868d0807

@ -95,10 +95,11 @@ static int exec_exec(struct ast_channel *chan, void *data)
char *s, *appname, *endargs, args[MAXRESULT] = "";
struct ast_app *app;
if (ast_strlen_zero(data))
return 0;
u = ast_module_user_add(chan);
/* Check and parse arguments */
if (data) {
s = ast_strdupa(data);
appname = strsep(&s, "(");
if (s) {
@ -116,9 +117,9 @@ static int exec_exec(struct ast_channel *chan, void *data)
res = -1;
}
}
}
ast_module_user_remove(u);
return res;
}
@ -129,10 +130,11 @@ static int tryexec_exec(struct ast_channel *chan, void *data)
char *s, *appname, *endargs, args[MAXRESULT] = "";
struct ast_app *app;
if (ast_strlen_zero(data))
return 0;
u = ast_module_user_add(chan);
/* Check and parse arguments */
if (data) {
s = ast_strdupa(data);
appname = strsep(&s, "(");
if (s) {
@ -151,9 +153,9 @@ static int tryexec_exec(struct ast_channel *chan, void *data)
pbx_builtin_setvar_helper(chan, "TRYSTATUS", "NOAPP");
}
}
}
ast_module_user_remove(u);
return 0;
}

@ -75,8 +75,14 @@ static int flash_exec(struct ast_channel *chan, void *data)
int x;
struct ast_module_user *u;
struct zt_params ztp;
if (strcasecmp(chan->tech->type, "Zap")) {
ast_log(LOG_WARNING, "%s is not a Zap channel\n", chan->name);
return -1;
}
u = ast_module_user_add(chan);
if (!strcasecmp(chan->tech->type, "Zap")) {
memset(&ztp, 0, sizeof(ztp));
res = ioctl(chan->fds[0], ZT_GET_PARAMS, &ztp);
if (!res) {
@ -97,9 +103,9 @@ static int flash_exec(struct ast_channel *chan, void *data)
ast_log(LOG_WARNING, "%s is not an FXO Channel\n", chan->name);
} else
ast_log(LOG_WARNING, "Unable to get parameters of %s: %s\n", chan->name, strerror(errno));
} else
ast_log(LOG_WARNING, "%s is not a Zap channel\n", chan->name);
ast_module_user_remove(u);
return res;
}

@ -96,9 +96,7 @@ static int sendimage_exec(struct ast_channel *chan, void *data)
return 0;
}
res = ast_send_image(chan, args.filename);
if (!res)
if (!(res = ast_send_image(chan, args.filename)))
pbx_builtin_setvar_helper(chan, "SENDIMAGESTATUS", "OK");
ast_module_user_remove(u);

Loading…
Cancel
Save