[asterisk-commits] mnicholson: testsuite/asterisk/trunk r376 - /asterisk/trunk/asttest/lib/lua/

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Wed Jun 9 10:47:39 CDT 2010


Author: mnicholson
Date: Wed Jun  9 10:47:35 2010
New Revision: 376

URL: http://svnview.digium.com/svn/testsuite?view=rev&rev=376
Log:
Don't copy the /var/run/asterisk dir, just create it

Modified:
    asterisk/trunk/asttest/lib/lua/astlib.c

Modified: asterisk/trunk/asttest/lib/lua/astlib.c
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/asttest/lib/lua/astlib.c?view=diff&rev=376&r1=375&r2=376
==============================================================================
--- asterisk/trunk/asttest/lib/lua/astlib.c (original)
+++ asterisk/trunk/asttest/lib/lua/astlib.c Wed Jun  9 10:47:35 2010
@@ -350,14 +350,19 @@
 	int i;
 
 	/* directories must end in '/' */
-	const char *asterisk_dirs[] = {
+	const char *copy_dirs[] = {
 		"/etc/asterisk/",
 		"/usr/lib/asterisk/modules/",
 		"/usr/include/asterisk/",
 		"/var/lib/asterisk/",
-		"/var/run/asterisk/",
 		"/var/log/asterisk/",
 		"/var/spool/asterisk/",
+		NULL,
+	};
+
+	/* directories must end in '/' */
+	const char *create_dirs[] = {
+		"/var/run/asterisk/",
 		NULL,
 	};
 
@@ -382,9 +387,9 @@
 	asterisk_path = lua_tostring(L, -1);
 
 	/* copy directories */
-	for (i = 0; asterisk_dirs[i]; i++) {
-		snprintf(src_buf, sizeof(src_buf), "%s%s", asterisk_path, asterisk_dirs[i]);
-		snprintf(dst_buf, sizeof(dst_buf), "%s%s", work_area, asterisk_dirs[i]);
+	for (i = 0; copy_dirs[i]; i++) {
+		snprintf(src_buf, sizeof(src_buf), "%s%s", asterisk_path, copy_dirs[i]);
+		snprintf(dst_buf, sizeof(dst_buf), "%s%s", work_area, copy_dirs[i]);
 		if (mkdir_p(dst_buf, dir_mode)) {
 			lua_pushstring(L, "unable to create directory in work area (");
 			lua_pushstring(L, dst_buf);
@@ -397,6 +402,20 @@
 		if (symlink_copy_dir(L, src_buf, dst_buf)) {
 			lua_pushstring(L, "\nerror initilizing work area");
 			lua_concat(L, 2);
+			return lua_error(L);
+		}
+	}
+
+	/* create directories */
+	for (i = 0; create_dirs[i]; i++) {
+		snprintf(src_buf, sizeof(src_buf), "%s%s", asterisk_path, create_dirs[i]);
+		snprintf(dst_buf, sizeof(dst_buf), "%s%s", work_area, create_dirs[i]);
+		if (mkdir_p(dst_buf, dir_mode)) {
+			lua_pushstring(L, "unable to create directory in work area (");
+			lua_pushstring(L, dst_buf);
+			lua_pushstring(L, "): ");
+			lua_pushstring(L, strerror(errno));
+			lua_concat(L, 4);
 			return lua_error(L);
 		}
 	}




More information about the asterisk-commits mailing list