]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
Close file after we do the translation, and map memory for both reading/writing....
authorJoshua Colp <jcolp@digium.com>
Wed, 24 Jan 2007 00:22:50 +0000 (00:22 +0000)
committerJoshua Colp <jcolp@digium.com>
Wed, 24 Jan 2007 00:22:50 +0000 (00:22 +0000)
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@51831 65c4cc65-6c06-0410-ace0-fbb531ad65f3

main/manager.c

index ca83f3c00ed3d2e3dabd7fbc80db30784142206d..4464d9dce2e9db644d18339331382092dacc9905 100644 (file)
@@ -2820,10 +2820,9 @@ static struct ast_str *generic_http_callback(enum output_format format,
                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 @@ static struct ast_str *generic_http_callback(enum output_format format,
                                xml_translate(&out, "", params, format);
                        }
                }
+               fclose(s->f);
                s->f = NULL;
                s->fd = -1;
        }