diff options
author | Derick Rethans <derick@php.net> | 2006-01-04 12:22:23 +0000 |
---|---|---|
committer | Derick Rethans <derick@php.net> | 2006-01-04 12:22:23 +0000 |
commit | 223aa7294d6c072c84df5d3a350606f3774f58d9 (patch) | |
tree | f82a2029f2540e9fb5a2cfc8bc2a28ce2c347f23 /TSRM | |
parent | 42736d6d70b72767221c445bb2b2075611186698 (diff) | |
download | php-git-223aa7294d6c072c84df5d3a350606f3774f58d9.tar.gz |
- Added the lchown() and lchgrp() functions which change permissions and group
permissions on symbolic links.
#- We'll also add this to PHP 5.1.3? or PHP 5.2, so I didn't add it to NEWS.
Diffstat (limited to 'TSRM')
-rw-r--r-- | TSRM/tsrm_virtual_cwd.c | 12 | ||||
-rw-r--r-- | TSRM/tsrm_virtual_cwd.h | 6 |
2 files changed, 14 insertions, 4 deletions
diff --git a/TSRM/tsrm_virtual_cwd.c b/TSRM/tsrm_virtual_cwd.c index 5d9f04bb4d..8aa21905dd 100644 --- a/TSRM/tsrm_virtual_cwd.c +++ b/TSRM/tsrm_virtual_cwd.c @@ -777,7 +777,7 @@ CWD_API int virtual_chmod(const char *filename, mode_t mode TSRMLS_DC) } #if !defined(TSRM_WIN32) && !defined(NETWARE) -CWD_API int virtual_chown(const char *filename, uid_t owner, gid_t group TSRMLS_DC) +CWD_API int virtual_chown(const char *filename, uid_t owner, gid_t group, int link TSRMLS_DC) { cwd_state new_state; int ret; @@ -785,7 +785,15 @@ CWD_API int virtual_chown(const char *filename, uid_t owner, gid_t group TSRMLS_ CWD_STATE_COPY(&new_state, &CWDG(cwd)); virtual_file_ex(&new_state, filename, NULL, 0); - ret = chown(new_state.cwd, owner, group); + if (link) { +#if HAVE_LCHOWN + ret = lchown(new_state.cwd, owner, group); +#else + ret = -1; +#endif + } else { + ret = chown(new_state.cwd, owner, group); + } CWD_STATE_FREE(&new_state); return ret; diff --git a/TSRM/tsrm_virtual_cwd.h b/TSRM/tsrm_virtual_cwd.h index 2b64cf4336..c351319762 100644 --- a/TSRM/tsrm_virtual_cwd.h +++ b/TSRM/tsrm_virtual_cwd.h @@ -190,7 +190,7 @@ CWD_API int virtual_utime(const char *filename, struct utimbuf *buf TSRMLS_DC); #endif CWD_API int virtual_chmod(const char *filename, mode_t mode TSRMLS_DC); #if !defined(TSRM_WIN32) && !defined(NETWARE) -CWD_API int virtual_chown(const char *filename, uid_t owner, gid_t group TSRMLS_DC); +CWD_API int virtual_chown(const char *filename, uid_t owner, gid_t group, int link TSRMLS_DC); #endif CWD_API int virtual_file_ex(cwd_state *state, const char *path, verify_path_func verify_path, int use_realpath); @@ -262,7 +262,8 @@ extern virtual_cwd_globals cwd_globals; #endif #define VCWD_CHMOD(path, mode) virtual_chmod(path, mode TSRMLS_CC) #if !defined(TSRM_WIN32) && !defined(NETWARE) -#define VCWD_CHOWN(path, owner, group) virtual_chown(path, owner, group TSRMLS_CC) +#define VCWD_CHOWN(path, owner, group) virtual_chown(path, owner, group, 0 TSRMLS_CC) +#define VCWD_LCHOWN(path, owner, group) virtual_chown(path, owner, group, 1 TSRMLS_CC) #endif #else @@ -305,6 +306,7 @@ extern virtual_cwd_globals cwd_globals; #define VCWD_CHMOD(path, mode) chmod(path, mode) #if !defined(TSRM_WIN32) && !defined(NETWARE) #define VCWD_CHOWN(path, owner, group) chown(path, owner, group) +#define VCWD_LCHOWN(path, owner, group) lchown(path, owner, group) #endif #endif |