cvs: php4 /ext/session mod_mm.c

From: Date: Wed, 06 Mar 2002 08:54:56 +0000
Subject: cvs: php4 /ext/session mod_mm.c
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-9715@lists.php.net to get a copy of this message
yohgaki Wed Mar 6 03:54:56 2002 EDT Modified files: /php4/ext/session mod_mm.c Log: Use static mm file save path. Now we can safely stop web server at start up when there is an error. Older mm uses static mm file path anyway. Index: php4/ext/session/mod_mm.c diff -u php4/ext/session/mod_mm.c:1.34 php4/ext/session/mod_mm.c:1.35 --- php4/ext/session/mod_mm.c:1.34 Wed Mar 6 01:29:43 2002 +++ php4/ext/session/mod_mm.c Wed Mar 6 03:54:55 2002 @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: mod_mm.c,v 1.34 2002/03/06 06:29:43 yohgaki Exp $ */ +/* $Id: mod_mm.c,v 1.35 2002/03/06 08:54:55 yohgaki Exp $ */ #include "php.h" @@ -249,7 +249,6 @@ PHP_MINIT_FUNCTION(ps_mm) { - int save_path_len = strlen(PS(save_path)); int mod_name_len = strlen(sapi_module.name); char *ps_mm_path, euid[30]; int ret; @@ -257,20 +256,18 @@ ps_mm_instance = calloc(sizeof(*ps_mm_instance), 1); if (!ps_mm_instance) { php_error(E_WARNING,"mm session save handler cannot allocate shared memory"); + return FAILURE; } if (!sprintf(euid,"%d", geteuid())) { php_error(E_WARNING,"mm session save handler cannot get effecitve UID"); + return FAILURE; } - /* Directory + '/' + File + Module Name + Effective UID + \0 */ - ps_mm_path = do_alloca(save_path_len+1+sizeof(PS_MM_FILE)+mod_name_len+strlen(euid)+1); + /* '/tmp/' + File + Module Name + Effective UID + \0 */ + ps_mm_path = do_alloca(5+sizeof(PS_MM_FILE)+mod_name_len+strlen(euid)+1); - memcpy(ps_mm_path, PS(save_path), save_path_len + 1); - if (save_path_len > 0 && ps_mm_path[save_path_len - 1] != DEFAULT_SLASH) { - ps_mm_path[save_path_len] = DEFAULT_SLASH; - ps_mm_path[save_path_len+1] = '\0'; - } + memcpy(ps_mm_path, "/tmp/", 5); strcat(ps_mm_path, PS_MM_FILE); strcat(ps_mm_path, sapi_module.name); strcat(ps_mm_path, euid); @@ -283,6 +280,7 @@ free(ps_mm_instance); ps_mm_instance = NULL; php_error(E_NOTICE,"mm session save handler failed to initialize. Check your save_path."); + return FAILURE; } php_session_register_module(&ps_mod_mm);

« previous php.cvs (#9715) next »