diff src/os/unix/ngx_shmem.c @ 188:af37b7cb6698 NGINX_0_3_41

nginx 0.3.41 *) Feature: the -v switch. *) Bugfix: the segmentation fault may occurred if the SSI page has remote subrequests. *) Bugfix: in FastCGI handling. *) Bugfix: if the perl modules path was not set using --with-perl_modules_path=PATH or the "perl_modules", then the segmentation fault was occurred.
author Igor Sysoev <http://sysoev.ru>
date Fri, 21 Apr 2006 00:00:00 +0400
parents bb61aa162c6b
children
line wrap: on
line diff
--- a/src/os/unix/ngx_shmem.c
+++ b/src/os/unix/ngx_shmem.c
@@ -13,8 +13,9 @@
 ngx_int_t
 ngx_shm_alloc(ngx_shm_t *shm)
 {
-    shm->addr = mmap(NULL, shm->size,
-                     PROT_READ|PROT_WRITE, MAP_ANON|MAP_SHARED, -1, 0);
+    shm->addr = (u_char *) mmap(NULL, shm->size,
+                                PROT_READ|PROT_WRITE,
+                                MAP_ANON|MAP_SHARED, -1, 0);
 
     if (shm->addr == MAP_FAILED) {
         ngx_log_error(NGX_LOG_ALERT, shm->log, ngx_errno,
@@ -29,7 +30,7 @@ ngx_shm_alloc(ngx_shm_t *shm)
 void
 ngx_shm_free(ngx_shm_t *shm)
 {
-    if (munmap(shm->addr, shm->size) == -1) {
+    if (munmap((void *) shm->addr, shm->size) == -1) {
         ngx_log_error(NGX_LOG_ALERT, shm->log, ngx_errno,
                       "munmap(%p, %uz) failed", shm->addr, shm->size);
     }
@@ -50,7 +51,8 @@ ngx_shm_alloc(ngx_shm_t *shm)
         return NGX_ERROR;
     }
 
-    shm->addr = mmap(NULL, shm->size, PROT_READ|PROT_WRITE, MAP_SHARED, fd, 0);
+    shm->addr = (u_char *) mmap(NULL, shm->size, PROT_READ|PROT_WRITE,
+                                MAP_SHARED, fd, 0);
 
     if (shm->addr == MAP_FAILED) {
         ngx_log_error(NGX_LOG_ALERT, shm->log, ngx_errno,
@@ -69,7 +71,7 @@ ngx_shm_alloc(ngx_shm_t *shm)
 void
 ngx_shm_free(ngx_shm_t *shm)
 {
-    if (munmap(shm->addr, shm->size) == -1) {
+    if (munmap((void *) shm->addr, shm->size) == -1) {
         ngx_log_error(NGX_LOG_ALERT, shm->log, ngx_errno,
                       "munmap(%p, %uz) failed", shm->addr, shm->size);
     }