mirror of
https://github.com/asterisk/asterisk.git
synced 2025-11-09 11:28:25 +00:00
Create directory if it does not exist.
(Closes issue 10061, Reported and patched by eliel) git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@71914 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
@@ -81,6 +81,7 @@ static int record_exec(struct ast_channel *chan, void *data)
|
|||||||
int count = 0;
|
int count = 0;
|
||||||
int percentflag = 0;
|
int percentflag = 0;
|
||||||
char *filename, *ext = NULL, *silstr, *maxstr, *options;
|
char *filename, *ext = NULL, *silstr, *maxstr, *options;
|
||||||
|
char *file, *dir;
|
||||||
char *vdata, *p;
|
char *vdata, *p;
|
||||||
int i = 0;
|
int i = 0;
|
||||||
char tmp[256];
|
char tmp[256];
|
||||||
@@ -264,6 +265,11 @@ static int record_exec(struct ast_channel *chan, void *data)
|
|||||||
ast_dsp_set_threshold(sildet, 256);
|
ast_dsp_set_threshold(sildet, 256);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Create the directory if it does not exist. */
|
||||||
|
dir = ast_strdupa(tmp);
|
||||||
|
if ((file = strrchr(dir, '/')))
|
||||||
|
*file++ = '\0';
|
||||||
|
ast_mkdir (dir, 0777);
|
||||||
|
|
||||||
flags = option_append ? O_CREAT|O_APPEND|O_WRONLY : O_CREAT|O_TRUNC|O_WRONLY;
|
flags = option_append ? O_CREAT|O_APPEND|O_WRONLY : O_CREAT|O_TRUNC|O_WRONLY;
|
||||||
s = ast_writefile( tmp, ext, NULL, flags , 0, AST_FILE_MODE);
|
s = ast_writefile( tmp, ext, NULL, flags , 0, AST_FILE_MODE);
|
||||||
|
|||||||
Reference in New Issue
Block a user