mirror of
https://github.com/asterisk/asterisk.git
synced 2025-11-19 08:11:21 +00:00
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
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user