summaryrefslogtreecommitdiff
path: root/ext/session/mod_files.c
diff options
context:
space:
mode:
Diffstat (limited to 'ext/session/mod_files.c')
-rw-r--r--ext/session/mod_files.c28
1 files changed, 14 insertions, 14 deletions
diff --git a/ext/session/mod_files.c b/ext/session/mod_files.c
index 6ea33a71aa..cb61c8a221 100644
--- a/ext/session/mod_files.c
+++ b/ext/session/mod_files.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
@@ -57,13 +57,13 @@
#endif
typedef struct {
- int fd;
char *lastkey;
char *basedir;
size_t basedir_len;
size_t dirdepth;
size_t st_size;
int filemode;
+ int fd;
} ps_files;
ps_module ps_mod_files = {
@@ -187,7 +187,7 @@ static int ps_files_cleanup_dir(const char *dirname, int maxlifetime TSRMLS_DC)
DIR *dir;
char dentry[sizeof(struct dirent) + MAXPATHLEN];
struct dirent *entry = (struct dirent *) &dentry;
- php_stat_t sbuf;
+ zend_stat_t sbuf;
char buf[MAXPATHLEN];
time_t now;
int nrdels = 0;
@@ -238,7 +238,7 @@ static int ps_files_cleanup_dir(const char *dirname, int maxlifetime TSRMLS_DC)
static int ps_files_key_exists(ps_files *data, const char *key TSRMLS_DC)
{
char buf[MAXPATHLEN];
- php_stat_t sbuf;
+ zend_stat_t sbuf;
if (!key || !ps_files_path_create(buf, sizeof(buf), data, key)) {
return FAILURE;
@@ -283,7 +283,7 @@ PS_OPEN_FUNC(files)
if (argc > 1) {
errno = 0;
- dirdepth = (size_t) ZEND_STRTOI(argv[0], NULL, 10);
+ dirdepth = (size_t) ZEND_STRTOL(argv[0], NULL, 10);
if (errno == ERANGE) {
php_error(E_WARNING, "The first parameter in session.save_path is invalid");
return FAILURE;
@@ -292,7 +292,7 @@ PS_OPEN_FUNC(files)
if (argc > 2) {
errno = 0;
- filemode = ZEND_STRTOI(argv[1], NULL, 8);
+ filemode = ZEND_STRTOL(argv[1], NULL, 8);
if (errno == ERANGE || filemode < 0 || filemode > 07777) {
php_error(E_WARNING, "The second parameter in session.save_path is invalid");
return FAILURE;
@@ -335,8 +335,8 @@ PS_CLOSE_FUNC(files)
PS_READ_FUNC(files)
{
- php_int_t n;
- struct stat sbuf;
+ zend_long n;
+ zend_stat_t sbuf;
PS_FILES_DATA;
/* If strict mode, check session id existence */
@@ -344,7 +344,7 @@ PS_READ_FUNC(files)
ps_files_key_exists(data, key? key->val : NULL TSRMLS_CC) == FAILURE) {
/* key points to PS(id), but cannot change here. */
if (key) {
- STR_RELEASE(PS(id));
+ zend_string_release(PS(id));
PS(id) = NULL;
}
PS(id) = PS(mod)->s_create_sid((void **)&data TSRMLS_CC);
@@ -363,7 +363,7 @@ PS_READ_FUNC(files)
return FAILURE;
}
- if (fstat(data->fd, &sbuf)) {
+ if (zend_fstat(data->fd, &sbuf)) {
return FAILURE;
}
@@ -374,7 +374,7 @@ PS_READ_FUNC(files)
return SUCCESS;
}
- *val = STR_ALLOC(sbuf.st_size, 0);
+ *val = zend_string_alloc(sbuf.st_size, 0);
#if defined(HAVE_PREAD)
n = pread(data->fd, (*val)->val, (*val)->len, 0);
@@ -389,7 +389,7 @@ PS_READ_FUNC(files)
} else {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "read returned less bytes than requested");
}
- STR_RELEASE(*val);
+ zend_string_release(*val);
return FAILURE;
}
@@ -398,7 +398,7 @@ PS_READ_FUNC(files)
PS_WRITE_FUNC(files)
{
- php_int_t n;
+ zend_long n;
PS_FILES_DATA;
ps_files_open(data, key->val TSRMLS_CC);
@@ -481,7 +481,7 @@ PS_CREATE_SID_FUNC(files)
/* Check collision */
if (data && ps_files_key_exists(data, sid? sid->val : NULL TSRMLS_CC) == SUCCESS) {
if (sid) {
- STR_RELEASE(sid);
+ zend_string_release(sid);
sid = NULL;
}
if (!(maxfail--)) {