[asterisk-commits] trunk r14463 - in /trunk: ./ apps/app_readfile.c

asterisk-commits at lists.digium.com asterisk-commits at lists.digium.com
Thu Mar 23 13:15:03 MST 2006


Author: russell
Date: Thu Mar 23 14:15:01 2006
New Revision: 14463

URL: http://svn.digium.com/view/asterisk?rev=14463&view=rev
Log:
Merged revisions 14462 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/branches/1.2

........
r14462 | russell | 2006-03-23 15:13:48 -0500 (Thu, 23 Mar 2006) | 2 lines

don't crash when asked to read from a file that doesn't exist (issue #6786)

........

Modified:
    trunk/   (props changed)
    trunk/apps/app_readfile.c

Propchange: trunk/
------------------------------------------------------------------------------
Binary property 'branch-1.2-merged' - no diff available.

Modified: trunk/apps/app_readfile.c
URL: http://svn.digium.com/view/asterisk/trunk/apps/app_readfile.c?rev=14463&r1=14462&r2=14463&view=diff
==============================================================================
--- trunk/apps/app_readfile.c (original)
+++ trunk/apps/app_readfile.c Thu Mar 23 14:15:01 2006
@@ -92,15 +92,16 @@
 		}
 	}
 
-	returnvar = ast_read_textfile(file);
-	if(len > 0){
-		if(len < strlen(returnvar))
-			returnvar[len]='\0';
-		else
-			ast_log(LOG_WARNING,"%s is longer than %d, and %d \n", file, len, (int)strlen(returnvar));
+	if ((returnvar = ast_read_textfile(file))) {
+		if (len > 0) {
+			if (len < strlen(returnvar))
+				returnvar[len]='\0';
+			else
+				ast_log(LOG_WARNING, "%s is longer than %d, and %d \n", file, len, (int)strlen(returnvar));
+		}
+		pbx_builtin_setvar_helper(chan, varname, returnvar);
+		free(returnvar);
 	}
-	pbx_builtin_setvar_helper(chan, varname, returnvar);
-	free(returnvar);
 	LOCAL_USER_REMOVE(u);
 	return res;
 }



More information about the asterisk-commits mailing list