diff options
author | tilghman <tilghman@f38db490-d61c-443f-a65b-d21fe96a405b> | 2007-06-24 16:20:18 +0000 |
---|---|---|
committer | tilghman <tilghman@f38db490-d61c-443f-a65b-d21fe96a405b> | 2007-06-24 16:20:18 +0000 |
commit | 5e53d26887ddcb83d7847a5b7f5dfd508e495d74 (patch) | |
tree | 9fe26c27ae9f23503e17722ac7e7dbb8ee4898c5 /apps/app_mixmonitor.c | |
parent | efe111a8bb7bb634fa6712a2a38b4adb2e0f5c6d (diff) |
Issue 9970 - Ensure directory exists before trying to write an output file
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@71268 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'apps/app_mixmonitor.c')
-rw-r--r-- | apps/app_mixmonitor.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/apps/app_mixmonitor.c b/apps/app_mixmonitor.c index 96782c537..4ca27bdf7 100644 --- a/apps/app_mixmonitor.c +++ b/apps/app_mixmonitor.c @@ -304,7 +304,7 @@ static int mixmonitor_exec(struct ast_channel *chan, void *data) int x, readvol = 0, writevol = 0; struct ast_module_user *u; struct ast_flags flags = {0}; - char *parse; + char *parse, *tmp, *slash; AST_DECLARE_APP_ARGS(args, AST_APP_ARG(filename); AST_APP_ARG(options); @@ -373,6 +373,11 @@ static int mixmonitor_exec(struct ast_channel *chan, void *data) args.filename = build; } + tmp = ast_strdupa(args.filename); + if ((slash = strrchr(tmp, '/'))) + *slash = '\0'; + ast_mkdir(tmp, 0777); + pbx_builtin_setvar_helper(chan, "MIXMONITOR_FILENAME", args.filename); launch_monitor_thread(chan, args.filename, flags.flags, readvol, writevol, args.post_process); |