cvs: php4 /ext/session mod_files.c session.c

From: Date: Sun, 03 Feb 2002 05:40:19 +0000
Subject: cvs: php4 /ext/session mod_files.c session.c
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-9251@lists.php.net to get a copy of this message
yohgaki Sun Feb 3 00:40:19 2002 EDT Modified files: /php4/ext/session session.c mod_files.c Log: Revert last commit. Last patch has problem for the 1st request. # I also found what's wrong in mod_mm.c :) # I'll fix it later since don't have much time now. Index: php4/ext/session/session.c diff -u php4/ext/session/session.c:1.272 php4/ext/session/session.c:1.273 --- php4/ext/session/session.c:1.272 Sat Feb 2 22:17:35 2002 +++ php4/ext/session/session.c Sun Feb 3 00:40:19 2002 @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: session.c,v 1.272 2002/02/03 03:17:35 yohgaki Exp $ */ +/* $Id: session.c,v 1.273 2002/02/03 05:40:19 yohgaki Exp $ */ #ifdef HAVE_CONFIG_H #include "config.h" @@ -543,21 +543,19 @@ return estrdup(buf); } -static int php_session_initialize(TSRMLS_D) +static void php_session_initialize(TSRMLS_D) { char *val; int vallen; if (PS(mod)->open(&PS(mod_data), PS(save_path), PS(session_name)) == FAILURE) { php_error(E_ERROR, "Failed to initialize session module"); - return FAILURE; + return; } - if (PS(mod)->read(&PS(mod_data), PS(id), &val, &vallen) == FAILURE) { - return FAILURE; + if (PS(mod)->read(&PS(mod_data), PS(id), &val, &vallen) == SUCCESS) { + php_session_decode(val, vallen TSRMLS_CC); + efree(val); } - php_session_decode(val, vallen TSRMLS_CC); - efree(val); - return SUCCESS; } @@ -948,10 +946,11 @@ } php_session_cache_limiter(TSRMLS_C); - if (php_session_initialize(TSRMLS_C) == SUCCESS && - PS(mod_data) && PS(gc_probability) > 0) { + php_session_initialize(TSRMLS_C); + + if (PS(mod_data) && PS(gc_probability) > 0) { int nrdels = -1; - + nrand = (int) (100.0*php_combined_lcg(TSRMLS_C)); if (nrand < PS(gc_probability)) { PS(mod)->gc(&PS(mod_data), PS(gc_maxlifetime), &nrdels); @@ -962,7 +961,6 @@ } } } - static zend_bool php_session_destroy(TSRMLS_D) { Index: php4/ext/session/mod_files.c diff -u php4/ext/session/mod_files.c:1.66 php4/ext/session/mod_files.c:1.67 --- php4/ext/session/mod_files.c:1.66 Sat Feb 2 22:17:35 2002 +++ php4/ext/session/mod_files.c Sun Feb 3 00:40:19 2002 @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: mod_files.c,v 1.66 2002/02/03 03:17:35 yohgaki Exp $ */ +/* $Id: mod_files.c,v 1.67 2002/02/03 05:40:19 yohgaki Exp $ */ #include "php.h" @@ -123,7 +123,7 @@ } } -static int ps_files_open(ps_files *data, const char *key) +static void ps_files_open(ps_files *data, const char *key) { char buf[MAXPATHLEN]; TSRMLS_FETCH(); @@ -138,7 +138,7 @@ if (!ps_files_valid_key(key) || !ps_files_path_create(buf, sizeof(buf), data, key)) - return FAILURE; + return; data->lastkey = estrdup(key); @@ -153,13 +153,10 @@ if (data->fd != -1) flock(data->fd, LOCK_EX); - if (data->fd == -1) { + if (data->fd == -1) php_error(E_WARNING, "open(%s, O_RDWR) failed: %s (%d)", buf, strerror(errno), errno); - return FAILURE; - } } - return SUCCESS; } static int ps_files_cleanup_dir(const char *dirname, int maxlifetime) @@ -257,9 +254,7 @@ struct stat sbuf; PS_FILES_DATA; - if (ps_files_open(data, key) == FAILURE) - return FAILURE; - + ps_files_open(data, key); if (data->fd < 0) return FAILURE; @@ -288,9 +283,7 @@ long n; PS_FILES_DATA; - if (ps_files_open(data, key) == FAILURE) - return FAILURE; - + ps_files_open(data, key); if (data->fd < 0) return FAILURE;

« previous php.cvs (#9251) next »