[asterisk-commits] mmichelson: trunk r71914 - /trunk/apps/app_record.c
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Tue Jun 26 15:34:47 CDT 2007
Author: mmichelson
Date: Tue Jun 26 15:34:46 2007
New Revision: 71914
URL: http://svn.digium.com/view/asterisk?view=rev&rev=71914
Log:
Create directory if it does not exist.
(Closes issue 10061, Reported and patched by eliel)
Modified:
trunk/apps/app_record.c
Modified: trunk/apps/app_record.c
URL: http://svn.digium.com/view/asterisk/trunk/apps/app_record.c?view=diff&rev=71914&r1=71913&r2=71914
==============================================================================
--- trunk/apps/app_record.c (original)
+++ trunk/apps/app_record.c Tue Jun 26 15:34:46 2007
@@ -81,6 +81,7 @@
int count = 0;
int percentflag = 0;
char *filename, *ext = NULL, *silstr, *maxstr, *options;
+ char *file, *dir;
char *vdata, *p;
int i = 0;
char tmp[256];
@@ -263,8 +264,13 @@
}
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;
s = ast_writefile( tmp, ext, NULL, flags , 0, AST_FILE_MODE);
More information about the asterisk-commits
mailing list