Changed the tests on the return value from malloc_shared_memory() to make tinyproxy more portable, since we can't be certain that "if (!ret_value)" would actually detect a mmap() error.
This commit is contained in:
parent
de782144bd
commit
360deb4568
@ -1,4 +1,4 @@
|
|||||||
/* $Id: child.c,v 1.1 2002-05-26 18:45:26 rjkaes Exp $
|
/* $Id: child.c,v 1.2 2002-05-29 20:49:55 rjkaes Exp $
|
||||||
*
|
*
|
||||||
* Handles the creation/destruction of the various children required for
|
* Handles the creation/destruction of the various children required for
|
||||||
* processing incoming connections.
|
* processing incoming connections.
|
||||||
@ -276,7 +276,7 @@ child_pool_create(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
servers_waiting = malloc_shared_memory(sizeof(int));
|
servers_waiting = malloc_shared_memory(sizeof(int));
|
||||||
if (!servers_waiting) {
|
if (servers_waiting == MAP_FAILED) {
|
||||||
log_message(LOG_ERR, "Could not allocate memory for child counting.");
|
log_message(LOG_ERR, "Could not allocate memory for child counting.");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/* $Id: stats.c,v 1.11 2002-05-29 17:31:01 rjkaes Exp $
|
/* $Id: stats.c,v 1.12 2002-05-29 20:49:55 rjkaes Exp $
|
||||||
*
|
*
|
||||||
* This module handles the statistics for tinyproxy. There are only two
|
* This module handles the statistics for tinyproxy. There are only two
|
||||||
* public API functions. The reason for the functions, rather than just a
|
* public API functions. The reason for the functions, rather than just a
|
||||||
@ -45,7 +45,7 @@ void
|
|||||||
init_stats(void)
|
init_stats(void)
|
||||||
{
|
{
|
||||||
stats = malloc_shared_memory(sizeof(struct stat_s));
|
stats = malloc_shared_memory(sizeof(struct stat_s));
|
||||||
if (!stats)
|
if (stats == MAP_FAILED)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
memset(stats, 0, sizeof(struct stat));
|
memset(stats, 0, sizeof(struct stat));
|
||||||
|
Loading…
x
Reference in New Issue
Block a user