[asterisk-commits] file: trunk r51831 - /trunk/main/manager.c

asterisk-commits at lists.digium.com asterisk-commits at lists.digium.com
Tue Jan 23 17:22:50 MST 2007


Author: file
Date: Tue Jan 23 18:22:50 2007
New Revision: 51831

URL: http://svn.digium.com/view/asterisk?view=rev&rev=51831
Log:
Close file after we do the translation, and map memory for both reading/writing. (issue #8886 reported by cwegener)

Modified:
    trunk/main/manager.c

Modified: trunk/main/manager.c
URL: http://svn.digium.com/view/asterisk/trunk/main/manager.c?view=diff&rev=51831&r1=51830&r2=51831
==============================================================================
--- trunk/main/manager.c (original)
+++ trunk/main/manager.c Tue Jan 23 18:22:50 2007
@@ -2820,10 +2820,9 @@
 		char *buf;
 		size_t l = ftell(s->f);
 
-		fclose(s->f);
 		if (format == FORMAT_XML || format == FORMAT_HTML) {
 			if (l) {
-				if ((buf = mmap(NULL, l, PROT_READ, MAP_SHARED, s->fd, 0))) {
+				if ((buf = mmap(NULL, l, PROT_READ | PROT_WRITE, MAP_SHARED, s->fd, 0))) {
 					xml_translate(&out, buf, params, format);
 					munmap(buf, l);
 				}
@@ -2831,6 +2830,7 @@
 				xml_translate(&out, "", params, format);
 			}
 		}
+		fclose(s->f);
 		s->f = NULL;
 		s->fd = -1;
 	}



More information about the asterisk-commits mailing list