[svn-commits] tilghman: branch 1.4 r59281 - in /branches/1.4: ./ apps/app_voicemail.c

svn-commits at lists.digium.com svn-commits at lists.digium.com
Tue Mar 27 16:32:46 MST 2007


Author: tilghman
Date: Tue Mar 27 18:32:46 2007
New Revision: 59281

URL: http://svn.digium.com/view/asterisk?view=rev&rev=59281
Log:
Merged revisions 59280 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/branches/1.2

........
r59280 | tilghman | 2007-03-27 18:31:20 -0500 (Tue, 27 Mar 2007) | 2 lines

Fix a few remaining bad mmap(2) return values

........

Modified:
    branches/1.4/   (props changed)
    branches/1.4/apps/app_voicemail.c

Propchange: branches/1.4/
------------------------------------------------------------------------------
Binary property 'branch-1.2-merged' - no diff available.

Modified: branches/1.4/apps/app_voicemail.c
URL: http://svn.digium.com/view/asterisk/branches/1.4/apps/app_voicemail.c?view=diff&rev=59281&r1=59280&r2=59281
==============================================================================
--- branches/1.4/apps/app_voicemail.c (original)
+++ branches/1.4/apps/app_voicemail.c Tue Mar 27 18:32:46 2007
@@ -949,7 +949,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];
@@ -1066,7 +1066,7 @@
 					}
 					/* Read out in small chunks */
 					for (offset = 0; offset < colsize2; 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);
 							ast_odbc_release_obj(obj);
@@ -1344,7 +1344,7 @@
 	int x = 0;
 	int res;
 	int fd = -1;
-	void *fdm=NULL;
+	void *fdm = MAP_FAILED;
 	size_t fdlen = -1;
 	SQLHSTMT stmt;
 	SQLINTEGER len;
@@ -1400,7 +1400,7 @@
 		lseek(fd, 0, SEEK_SET);
 		printf("Length is %zd\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");
 			ast_odbc_release_obj(obj);
 			goto yuck;
@@ -1449,7 +1449,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 svn-commits mailing list