[svn-commits] tilghman: branch 1.6.2 r278025 - in /branches/1.6.2: ./ main/manager.c

SVN commits to the Digium repositories svn-commits at lists.digium.com
Tue Jul 20 11:54:28 CDT 2010


Author: tilghman
Date: Tue Jul 20 11:54:20 2010
New Revision: 278025

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=278025
Log:
Merged revisions 278024 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/trunk

................
  r278024 | tilghman | 2010-07-20 11:50:11 -0500 (Tue, 20 Jul 2010) | 14 lines
  
  Merged revisions 278023 via svnmerge from 
  https://origsvn.digium.com/svn/asterisk/branches/1.4
  
  ........
    r278023 | tilghman | 2010-07-20 11:37:18 -0500 (Tue, 20 Jul 2010) | 7 lines
    
    Off-by-one error
    
    (closes issue #16506)
     Reported by: nik600
     Patches: 
           20100629__issue16506.diff.txt uploaded by tilghman (license 14)
  ........
................

Modified:
    branches/1.6.2/   (props changed)
    branches/1.6.2/main/manager.c

Propchange: branches/1.6.2/
------------------------------------------------------------------------------
Binary property 'trunk-merged' - no diff available.

Modified: branches/1.6.2/main/manager.c
URL: http://svnview.digium.com/svn/asterisk/branches/1.6.2/main/manager.c?view=diff&rev=278025&r1=278024&r2=278025
==============================================================================
--- branches/1.6.2/main/manager.c (original)
+++ branches/1.6.2/main/manager.c Tue Jul 20 11:54:20 2010
@@ -3983,17 +3983,18 @@
 	if (s.f != NULL) {	/* have temporary output */
 		char *buf;
 		size_t l;
-		
-		/* Ensure buffer is NULL-terminated */
-		fprintf(s.f, "%c", 0);
 
 		if ((l = ftell(s.f))) {
-			if ((buf = mmap(NULL, l, PROT_READ | PROT_WRITE, MAP_SHARED, s.fd, 0))) {
-				if (format == FORMAT_XML || format == FORMAT_HTML)
+			if (MAP_FAILED == (buf = mmap(NULL, l + 1, PROT_READ | PROT_WRITE, MAP_PRIVATE, s.fd, 0))) {
+				ast_log(LOG_WARNING, "mmap failed.  Manager output was not processed\n");
+			} else {
+				buf[l] = '\0';
+				if (format == FORMAT_XML || format == FORMAT_HTML) {
 					xml_translate(&out, buf, params, format);
-				else
+				} else {
 					ast_str_append(&out, 0, "%s", buf);
-				munmap(buf, l);
+				}
+				munmap(buf, l + 1);
 			}
 		} else if (format == FORMAT_XML || format == FORMAT_HTML) {
 			xml_translate(&out, "", params, format);




More information about the svn-commits mailing list