diff options
author | Joshua Colp <jcolp@digium.com> | 2007-01-24 00:22:50 +0000 |
---|---|---|
committer | Joshua Colp <jcolp@digium.com> | 2007-01-24 00:22:50 +0000 |
commit | 68c1f5338f3ed1fdf3b177e1d7bedf5bd41fc505 (patch) | |
tree | 2a6bd7b740d8d31066be9bc1719bfa0f95add6ba | |
parent | 19a8da7bed6b0d25680c1b06775c1faa21a829b7 (diff) |
Close file after we do the translation, and map memory for both reading/writing. (issue #8886 reported by cwegener)
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@51831 65c4cc65-6c06-0410-ace0-fbb531ad65f3
-rw-r--r-- | main/manager.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/main/manager.c b/main/manager.c index ca83f3c00..4464d9dce 100644 --- a/main/manager.c +++ b/main/manager.c @@ -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; } |