cvs: php4 /ext/session mod_files.c

From: Date: Mon, 16 Oct 2000 10:35:44 +0000
Subject: cvs: php4 /ext/session mod_files.c
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-2068@lists.php.net to get a copy of this message
dbeu Mon Oct 16 03:35:44 2000 EDT Modified files: /php4/ext/session mod_files.c Log: fixes bug 7055 & 7235 Index: php4/ext/session/mod_files.c diff -u php4/ext/session/mod_files.c:1.47 php4/ext/session/mod_files.c:1.48 --- php4/ext/session/mod_files.c:1.47 Mon Sep 11 08:24:28 2000 +++ php4/ext/session/mod_files.c Mon Oct 16 03:35:43 2000 @@ -107,6 +107,14 @@ #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 @@ 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_FILES_DATA; - if (data->fd > -1) - close(data->fd); + ps_files_close(data); + if (data->lastkey) efree(data->lastkey); efree(data->basedir); @@ -272,6 +278,8 @@ if (!ps_files_path_create(buf, sizeof(buf), data, key)) return FAILURE; + + ps_files_close(data); if (V_UNLINK(buf) == -1) { return FAILURE;

« previous php.cvs (#2068) next »