Bug 674470: PR_MemMap returns NULL instead of (void *) -1 on error.
authorwtc%google.com
Thu, 28 Jul 2011 22:25:03 +0000
changeset 4338 a868dc8e4218d697cb8ad942f3f02271807a15ab
parent 4337 94b5dc69e9a2ed10a32763832844198ab5146d8d
child 4339 90044e3db22d4f577c741161ca80df839433c689
push idunknown
push userunknown
push dateunknown
bugs674470
Bug 674470: PR_MemMap returns NULL instead of (void *) -1 on error. r=gpascutto.
tools/httpget.c
--- a/tools/httpget.c
+++ b/tools/httpget.c
@@ -196,24 +196,23 @@ PRStatus FastFetchFile(PRFileDesc *in, P
     PRUint32 bytesToRead;
     PRStatus rv;
     PRInt64 sz64;
 
     LL_UI2L(sz64, size);
     outfMap = PR_CreateFileMap(out, sz64, PR_PROT_READWRITE);
     PR_ASSERT(outfMap);
     addr = PR_MemMap(outfMap, LL_ZERO, size);
-    if (addr == (void *) -1) {
+    if (addr == NULL) {
 	fprintf(stderr, "cannot memory-map file: (%d, %d)\n", PR_GetError(),
 		PR_GetOSError());
 
 	PR_CloseFileMap(outfMap);
 	return PR_FAILURE;
     }
-    PR_ASSERT(addr != (void *) -1);
     start = (char *) addr;
     rem = size;
     while ((nBytes = DrainInputBuffer(start, rem)) > 0) {
 	start += nBytes;
 	rem -= nBytes;
     }
     if (nBytes < 0) {
 	/* Input buffer is empty and end of stream */