Skip to content

Commit bd32363

Browse files
author
Yasuo Ohgaki
committed
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.
1 parent 4c6e58a commit bd32363

File tree

2 files changed

+14
-23
lines changed

2 files changed

+14
-23
lines changed

ext/session/mod_files.c

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ static void ps_files_close(ps_files *data)
123123
}
124124
}
125125

126-
static int ps_files_open(ps_files *data, const char *key)
126+
static void ps_files_open(ps_files *data, const char *key)
127127
{
128128
char buf[MAXPATHLEN];
129129
TSRMLS_FETCH();
@@ -138,7 +138,7 @@ static int ps_files_open(ps_files *data, const char *key)
138138

139139
if (!ps_files_valid_key(key) ||
140140
!ps_files_path_create(buf, sizeof(buf), data, key))
141-
return FAILURE;
141+
return;
142142

143143
data->lastkey = estrdup(key);
144144

@@ -153,13 +153,10 @@ static int ps_files_open(ps_files *data, const char *key)
153153
if (data->fd != -1)
154154
flock(data->fd, LOCK_EX);
155155

156-
if (data->fd == -1) {
156+
if (data->fd == -1)
157157
php_error(E_WARNING, "open(%s, O_RDWR) failed: %s (%d)", buf,
158158
strerror(errno), errno);
159-
return FAILURE;
160-
}
161159
}
162-
return SUCCESS;
163160
}
164161

165162
static int ps_files_cleanup_dir(const char *dirname, int maxlifetime)
@@ -257,9 +254,7 @@ PS_READ_FUNC(files)
257254
struct stat sbuf;
258255
PS_FILES_DATA;
259256

260-
if (ps_files_open(data, key) == FAILURE)
261-
return FAILURE;
262-
257+
ps_files_open(data, key);
263258
if (data->fd < 0)
264259
return FAILURE;
265260

@@ -288,9 +283,7 @@ PS_WRITE_FUNC(files)
288283
long n;
289284
PS_FILES_DATA;
290285

291-
if (ps_files_open(data, key) == FAILURE)
292-
return FAILURE;
293-
286+
ps_files_open(data, key);
294287
if (data->fd < 0)
295288
return FAILURE;
296289

ext/session/session.c

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -543,21 +543,19 @@ static char *_php_create_id(int *newlen TSRMLS_DC)
543543
return estrdup(buf);
544544
}
545545

546-
static int php_session_initialize(TSRMLS_D)
546+
static void php_session_initialize(TSRMLS_D)
547547
{
548548
char *val;
549549
int vallen;
550550

551551
if (PS(mod)->open(&PS(mod_data), PS(save_path), PS(session_name)) == FAILURE) {
552552
php_error(E_ERROR, "Failed to initialize session module");
553-
return FAILURE;
553+
return;
554554
}
555-
if (PS(mod)->read(&PS(mod_data), PS(id), &val, &vallen) == FAILURE) {
556-
return FAILURE;
555+
if (PS(mod)->read(&PS(mod_data), PS(id), &val, &vallen) == SUCCESS) {
556+
php_session_decode(val, vallen TSRMLS_CC);
557+
efree(val);
557558
}
558-
php_session_decode(val, vallen TSRMLS_CC);
559-
efree(val);
560-
return SUCCESS;
561559
}
562560

563561

@@ -948,10 +946,11 @@ static void php_session_start(TSRMLS_D)
948946
}
949947

950948
php_session_cache_limiter(TSRMLS_C);
951-
if (php_session_initialize(TSRMLS_C) == SUCCESS &&
952-
PS(mod_data) && PS(gc_probability) > 0) {
949+
php_session_initialize(TSRMLS_C);
950+
951+
if (PS(mod_data) && PS(gc_probability) > 0) {
953952
int nrdels = -1;
954-
953+
955954
nrand = (int) (100.0*php_combined_lcg(TSRMLS_C));
956955
if (nrand < PS(gc_probability)) {
957956
PS(mod)->gc(&PS(mod_data), PS(gc_maxlifetime), &nrdels);
@@ -963,7 +962,6 @@ static void php_session_start(TSRMLS_D)
963962
}
964963
}
965964

966-
967965
static zend_bool php_session_destroy(TSRMLS_D)
968966
{
969967
zend_bool retval = SUCCESS;

0 commit comments

Comments
 (0)