[asterisk-commits] oej: branch oej/minivoicemail-1.4 r262291 - /team/oej/minivoicemail-1.4/apps/

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Tue May 11 03:12:59 CDT 2010


Author: oej
Date: Tue May 11 03:12:55 2010
New Revision: 262291

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=262291
Log:
Prevent crash. Segfaults are no good (TM)

Modified:
    team/oej/minivoicemail-1.4/apps/app_minivm.c

Modified: team/oej/minivoicemail-1.4/apps/app_minivm.c
URL: http://svnview.digium.com/svn/asterisk/team/oej/minivoicemail-1.4/apps/app_minivm.c?view=diff&rev=262291&r1=262290&r2=262291
==============================================================================
--- team/oej/minivoicemail-1.4/apps/app_minivm.c (original)
+++ team/oej/minivoicemail-1.4/apps/app_minivm.c Tue May 11 03:12:55 2010
@@ -1915,11 +1915,11 @@
 	snprintf(tempfile, sizeof(tempfile), "%s%s/%s/temp", MVM_SPOOL_DIR, vmu->domain, username);
 	if (!(res = check_dirpath(dest, sizeof(dest), vmu->domain, username, "temp"))) {
 		if (option_debug > 1)
-			ast_log(LOG_DEBUG, "Temporary message directory does not exist, using default (%s)\n", tempfile);
+			ast_log(LOG_DEBUG, "-_-_- Using temporary message - %s\n", tempfile);
 		ast_copy_string(prefile, tempfile, sizeof(prefile));
 	}
 	if (option_debug > 1)
-		ast_log(LOG_DEBUG, "-_-_- Preparing to play message ...\n");
+		ast_log(LOG_DEBUG, "-_-_- Preparing to play message: %s...\n", prefile);
 
 	/* Check current or macro-calling context for special extensions */
 	if (ast_test_flag(vmu, MVM_OPERATOR)) {
@@ -2033,13 +2033,20 @@
 	int res = 0;
 	struct ast_module_user *u;
 	char filename[BUFSIZ];
+	char *chanvar;
 	
 	u = ast_module_user_add(chan);
 	
 	if (!ast_strlen_zero(data))
 		ast_copy_string(filename, (char *) data, sizeof(filename));
-	else
-		ast_copy_string(filename, pbx_builtin_getvar_helper(chan, "MVM_FILENAME"), sizeof(filename));
+	else {
+		chanvar = pbx_builtin_getvar_helper(chan, "MVM_FILENAME");
+		if (!ast_strlen_zero(chanvar)) {
+			ast_copy_string(filename, pbx_builtin_getvar_helper(chan, "MVM_FILENAME"), sizeof(filename));
+		} else {
+			filename[0] = '\0';
+		}
+	}
 
 	if (ast_strlen_zero(filename)) {
 		ast_module_user_remove(u);




More information about the asterisk-commits mailing list