[asterisk-commits] dlee: branch dlee/record r395101 - /team/dlee/record/res/stasis_recording/

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Mon Jul 22 23:36:34 CDT 2013


Author: dlee
Date: Mon Jul 22 23:36:32 2013
New Revision: 395101

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=395101
Log:
Path fixes

Modified:
    team/dlee/record/res/stasis_recording/stored.c

Modified: team/dlee/record/res/stasis_recording/stored.c
URL: http://svnview.digium.com/svn/asterisk/team/dlee/record/res/stasis_recording/stored.c?view=diff&rev=395101&r1=395100&r2=395101
==============================================================================
--- team/dlee/record/res/stasis_recording/stored.c (original)
+++ team/dlee/record/res/stasis_recording/stored.c Mon Jul 22 23:36:32 2013
@@ -229,6 +229,7 @@
 {
 	RAII_VAR(struct stasis_app_stored_recording *, recording, NULL,
 		ao2_cleanup);
+	RAII_VAR(struct ast_str *, name, NULL, ast_free);
 	const char *ext;
 
 	ext = strrchr(filename, '.');
@@ -259,13 +260,16 @@
 	recording->format = strrchr(recording->file, '.');
 	*(recording->format++) = '\0';
 
-	/* Build recurding name */
+	/* Build recording name */
+	name = ast_str_create(255);
+	if (!name) {
+		return -1;
+	}
 	if (!ast_strlen_zero(subdir)) {
-		ast_string_field_build(recording, name, "/%s", subdir);
-	}
-	if (!ast_strlen_zero(filename)) {
-		ast_string_field_build(recording, name, "/%s", filename);
-	}
+		ast_str_append(&name, 0, "/%s", subdir);
+	}
+	ast_str_append(&name, 0, "/%s", filename);
+	ast_string_field_set(recording, name, ast_str_buffer(name));
 
 	/* Add it to the recordings container */
 	ao2_link(recordings, recording);
@@ -294,18 +298,18 @@
 		return -1;
 	}
 	if (!ast_strlen_zero(subdir)) {
-		ast_str_append(&rel_dirname, 0, "/%s", subdir);
+		ast_str_append(&rel_dirname, 0, "%s/", subdir);
 	}
 	if (!ast_strlen_zero(dirname)) {
-		ast_str_append(&rel_dirname, 0, "/%s", dirname);
-	}
-
+		ast_str_append(&rel_dirname, 0, "%s", dirname);
+	}
+
+	/* Read the directory */
 	dir = opendir(path);
 	if (!dir) {
 		ast_log(LOG_WARNING, "Error reading dir '%s'\n", path);
 		return -1;
 	}
-
 	while (readdir_r(dir, &entry, &result) == 0 && result != NULL) {
 		scan(recordings, base_dir, ast_str_buffer(rel_dirname), result);
 	}
@@ -363,7 +367,7 @@
 		return NULL;
 	}
 
-	res = scan_dir(recordings, ast_config_AST_RECORDING_DIR, NULL, "",
+	res = scan_dir(recordings, ast_config_AST_RECORDING_DIR, "", "",
 		ast_config_AST_RECORDING_DIR);
 	if (res != 0) {
 		return NULL;




More information about the asterisk-commits mailing list