From: Tilghman Lesher Date: Sun, 24 Jun 2007 16:20:18 +0000 (+0000) Subject: Issue 9970 - Ensure directory exists before trying to write an output file X-Git-Tag: 1.6.0-beta1~3^2~2279 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=0296bd9957bf95dba534d6aecfae18650b31a201;p=thirdparty%2Fasterisk.git Issue 9970 - Ensure directory exists before trying to write an output file git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@71268 65c4cc65-6c06-0410-ace0-fbb531ad65f3 --- diff --git a/apps/app_mixmonitor.c b/apps/app_mixmonitor.c index 96782c5374..4ca27bdf7d 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);