From 7ab46420be1edfd7681e88d864b7a7937bf19714 Mon Sep 17 00:00:00 2001 From: Zeev Suraski Date: Tue, 31 Oct 2000 18:05:19 +0000 Subject: [PATCH] mode_t fixes --- ext/standard/file.c | 7 ++++--- ext/standard/filestat.c | 5 +++-- main/win95nt.h | 1 - 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/ext/standard/file.c b/ext/standard/file.c index 82f049f75d..4a97de3c62 100644 --- a/ext/standard/file.c +++ b/ext/standard/file.c @@ -1278,7 +1278,8 @@ PHP_FUNCTION(fseek) PHP_FUNCTION(mkdir) { pval **arg1, **arg2; - int ret,mode; + int ret; + mode_t mode; PLS_FETCH(); if (ARG_COUNT(ht) != 2 || zend_get_parameters_ex(2, &arg1, &arg2) == FAILURE) { @@ -1286,11 +1287,11 @@ PHP_FUNCTION(mkdir) } convert_to_string_ex(arg1); convert_to_long_ex(arg2); - mode = (*arg2)->value.lval; + mode = (mode_t) (*arg2)->value.lval; if (PG(safe_mode) &&(!php_checkuid((*arg1)->value.str.val, NULL, 3))) { RETURN_FALSE; } - ret = V_MKDIR((*arg1)->value.str.val,mode); + ret = V_MKDIR((*arg1)->value.str.val, mode); if (ret < 0) { php_error(E_WARNING,"MkDir failed (%s)", strerror(errno)); RETURN_FALSE; diff --git a/ext/standard/filestat.c b/ext/standard/filestat.c index 71b88c8e9b..fa70990154 100644 --- a/ext/standard/filestat.c +++ b/ext/standard/filestat.c @@ -324,7 +324,8 @@ PHP_FUNCTION(chown) PHP_FUNCTION(chmod) { pval **filename, **mode; - int ret,imode; + int ret; + mode_t imode; PLS_FETCH(); if (ZEND_NUM_ARGS()!=2 || zend_get_parameters_ex(2,&filename,&mode)==FAILURE) { @@ -341,7 +342,7 @@ PHP_FUNCTION(chmod) if (php_check_open_basedir((*filename)->value.str.val)) RETURN_FALSE; - imode = (*mode)->value.lval; + imode = (mode_t) (*mode)->value.lval; /* in safe mode, do not allow to setuid files. Setuiding files could allow users to gain privileges that safe mode doesn't give them. diff --git a/main/win95nt.h b/main/win95nt.h index a1cbd3bd1e..322207fdea 100644 --- a/main/win95nt.h +++ b/main/win95nt.h @@ -10,7 +10,6 @@ #include typedef int uid_t; typedef int gid_t; -typedef int mode_t; typedef char * caddr_t; #define lstat(x, y) stat(x, y) #define _IFIFO 0010000 /* fifo */ -- 2.50.1