diff options
author | Daniel Beulshausen <dbeu@php.net> | 2000-10-16 10:35:43 +0000 |
---|---|---|
committer | Daniel Beulshausen <dbeu@php.net> | 2000-10-16 10:35:43 +0000 |
commit | 4086197d9550d38989e309888fac2e036671e709 (patch) | |
tree | f985dc8d407b00689dd0c14a7daeef14395e2d8b /ext/session/mod_files.c | |
parent | 9c1097c4dbace6540e778dce331dc44856034692 (diff) | |
download | php-git-4086197d9550d38989e309888fac2e036671e709.tar.gz |
fixes bug 7055 & 7235
Diffstat (limited to 'ext/session/mod_files.c')
-rw-r--r-- | ext/session/mod_files.c | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/ext/session/mod_files.c b/ext/session/mod_files.c index 70554a2b07..061e0ca0ca 100644 --- a/ext/session/mod_files.c +++ b/ext/session/mod_files.c @@ -107,6 +107,14 @@ static char *ps_files_path_create(char *buf, size_t buflen, ps_files *data, cons #define O_BINARY 0 #endif +static void ps_files_close(ps_files *data) +{ + if (data->fd != -1) { + close(data->fd); + data->fd = -1; + } +} + static void ps_files_open(ps_files *data, const char *key) { char buf[MAXPATHLEN]; @@ -116,10 +124,8 @@ static void ps_files_open(ps_files *data, const char *key) efree(data->lastkey); data->lastkey = NULL; } - if (data->fd != -1) { - close(data->fd); - data->fd = -1; - } + + ps_files_close(data); if (!ps_files_valid_key(key) || !ps_files_path_create(buf, sizeof(buf), data, key)) @@ -209,8 +215,8 @@ PS_CLOSE_FUNC(files) { PS_FILES_DATA; - if (data->fd > -1) - close(data->fd); + ps_files_close(data); + if (data->lastkey) efree(data->lastkey); efree(data->basedir); @@ -273,6 +279,8 @@ PS_DESTROY_FUNC(files) if (!ps_files_path_create(buf, sizeof(buf), data, key)) return FAILURE; + ps_files_close(data); + if (V_UNLINK(buf) == -1) { return FAILURE; } |