diff options
author | Doug Bailey <dbailey@digium.com> | 2009-04-20 19:28:16 +0000 |
---|---|---|
committer | Doug Bailey <dbailey@digium.com> | 2009-04-20 19:28:16 +0000 |
commit | 9c2ff7bb1e5f7d80e273653e06b85a6cb69ef086 (patch) | |
tree | b1ce940e024c4d369b0c73870b62ebbfc0850f79 | |
parent | b5b18b781025872e066b5244951365e657b7d41c (diff) |
Merged revisions 189391 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4
........
r189391 | dbailey | 2009-04-20 14:10:56 -0500 (Mon, 20 Apr 2009) | 4 lines
Clean up problem with manager implementation of mmap where it was not testing against MAP_FAILED response.
Got rid of shadowed variable used in processign the mmap results.
Change test of mmap results to compare against MAP_FAILED
........
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@189419 65c4cc65-6c06-0410-ace0-fbb531ad65f3
-rw-r--r-- | channels/chan_iax2.c | 2 | ||||
-rw-r--r-- | main/db1-ast/recno/rec_open.c | 2 | ||||
-rw-r--r-- | main/manager.c | 4 |
3 files changed, 5 insertions, 3 deletions
diff --git a/channels/chan_iax2.c b/channels/chan_iax2.c index fd71e3acc..e07858fe1 100644 --- a/channels/chan_iax2.c +++ b/channels/chan_iax2.c @@ -2200,7 +2200,7 @@ static int try_firmware(char *s) return -1; } fwh = (struct ast_iax2_firmware_header*)mmap(NULL, stbuf.st_size, PROT_READ, MAP_PRIVATE, fd, 0); - if (fwh == (void *) -1) { + if (fwh == MAP_FAILED) { ast_log(LOG_WARNING, "mmap failed: %s\n", strerror(errno)); close(fd); return -1; diff --git a/main/db1-ast/recno/rec_open.c b/main/db1-ast/recno/rec_open.c index 0ebc8c7c4..0fb08258c 100644 --- a/main/db1-ast/recno/rec_open.c +++ b/main/db1-ast/recno/rec_open.c @@ -169,7 +169,7 @@ slow: if ((t->bt_rfp = fdopen(rfd, "r")) == NULL) t->bt_msize = sb.st_size; if ((t->bt_smap = mmap(NULL, t->bt_msize, PROT_READ, MAP_PRIVATE, rfd, - (off_t)0)) == (caddr_t)-1) + (off_t)0)) == MAP_FAILED goto slow; t->bt_cmap = t->bt_smap; t->bt_emap = t->bt_smap + sb.st_size; diff --git a/main/manager.c b/main/manager.c index 0e4c26a58..8d5511669 100644 --- a/main/manager.c +++ b/main/manager.c @@ -3921,7 +3921,9 @@ static struct ast_str *generic_http_callback(enum output_format format, size_t l = ftell(s.f); if (l) { - if ((buf = mmap(NULL, l, PROT_READ | PROT_WRITE, MAP_SHARED, s.fd, 0))) { + if (MAP_FAILED == (buf = mmap(NULL, l, PROT_READ | PROT_WRITE, MAP_PRIVATE, s.fd, 0))) { + ast_log(LOG_WARNING, "mmap failed. Manager output was not processed\n"); + } else { if (format == FORMAT_XML || format == FORMAT_HTML) xml_translate(&out, buf, params, format); else |