[asterisk-commits] tilghman: branch 1.2 r59280 -
/branches/1.2/apps/app_voicemail.c
asterisk-commits at lists.digium.com
asterisk-commits at lists.digium.com
Tue Mar 27 16:31:21 MST 2007
Author: tilghman
Date: Tue Mar 27 18:31:20 2007
New Revision: 59280
URL: http://svn.digium.com/view/asterisk?view=rev&rev=59280
Log:
Fix a few remaining bad mmap(2) return values
Modified:
branches/1.2/apps/app_voicemail.c
Modified: branches/1.2/apps/app_voicemail.c
URL: http://svn.digium.com/view/asterisk/branches/1.2/apps/app_voicemail.c?view=diff&rev=59280&r1=59279&r2=59280
==============================================================================
--- branches/1.2/apps/app_voicemail.c (original)
+++ branches/1.2/apps/app_voicemail.c Tue Mar 27 18:31:20 2007
@@ -836,7 +836,7 @@
int res;
int fd=-1;
size_t fdlen = 0;
- void *fdm=NULL;
+ void *fdm = MAP_FAILED;
SQLSMALLINT colcount=0;
SQLHSTMT stmt;
char sql[PATH_MAX];
@@ -944,7 +944,7 @@
}
/* Read out in small chunks */
for (offset = 0; offset < colsize; offset += CHUNKSIZE) {
- if ((fdm = mmap(NULL, CHUNKSIZE, PROT_READ | PROT_WRITE, MAP_SHARED, fd, offset)) == (void *)-1) {
+ if ((fdm = mmap(NULL, CHUNKSIZE, PROT_READ | PROT_WRITE, MAP_SHARED, fd, offset)) == MAP_FAILED) {
ast_log(LOG_WARNING, "Could not mmap the output file: %s (%d)\n", strerror(errno), errno);
SQLFreeHandle(SQL_HANDLE_STMT, stmt);
goto yuck;
@@ -1207,7 +1207,7 @@
int x = 0;
int res;
int fd = -1;
- void *fdm=NULL;
+ void *fdm = MAP_FAILED;
size_t fdlen = -1;
SQLHSTMT stmt;
SQLINTEGER len;
@@ -1262,7 +1262,7 @@
lseek(fd, 0, SEEK_SET);
printf("Length is %d\n", fdlen);
fdm = mmap(NULL, fdlen, PROT_READ | PROT_WRITE, MAP_SHARED,fd, 0);
- if (!fdm) {
+ if (fdm != MAP_FAILED) {
ast_log(LOG_WARNING, "Memory map failed!\n");
goto yuck;
}
@@ -1319,7 +1319,7 @@
yuck:
if (cfg)
ast_config_destroy(cfg);
- if (fdm)
+ if (fdm != MAP_FAILED)
munmap(fdm, fdlen);
if (fd > -1)
close(fd);
More information about the asterisk-commits
mailing list