diff options
author | Mark A. Hershberger <mah@debian.(none)> | 2009-03-25 00:34:37 -0400 |
---|---|---|
committer | Mark A. Hershberger <mah@debian.(none)> | 2009-03-25 00:34:37 -0400 |
commit | 10f5b47dc7c1cf2b9a00991629f43652710322d3 (patch) | |
tree | 3b727a16f652b8042d573e90f003868ffb3b56c7 /TSRM | |
parent | 0e920280a2e04b110827bb766b9f29e3d581c4ee (diff) | |
download | php-10f5b47dc7c1cf2b9a00991629f43652710322d3.tar.gz |
Imported Upstream version 5.0.5upstream/5.0.5
Diffstat (limited to 'TSRM')
-rw-r--r-- | TSRM/TSRM.c | 18 | ||||
-rw-r--r-- | TSRM/threads.m4 | 2 | ||||
-rw-r--r-- | TSRM/tsrm_virtual_cwd.c | 61 | ||||
-rw-r--r-- | TSRM/tsrm_virtual_cwd.h | 10 |
4 files changed, 31 insertions, 60 deletions
diff --git a/TSRM/TSRM.c b/TSRM/TSRM.c index e9ae95d8e..cbbf06010 100644 --- a/TSRM/TSRM.c +++ b/TSRM/TSRM.c @@ -535,12 +535,6 @@ TSRM_API void tsrm_mutex_free(MUTEX_T mutexp) #ifdef TSRM_WIN32 DeleteCriticalSection(mutexp); free(mutexp); -#elif defined(NETWARE) -#ifdef USE_MPK - kMutexFree(mutexp); -#else - NXMutexFree(mutexp); -#endif #elif defined(GNUPTH) free(mutexp); #elif defined(PTHREADS) @@ -570,12 +564,6 @@ TSRM_API int tsrm_mutex_lock(MUTEX_T mutexp) #ifdef TSRM_WIN32 EnterCriticalSection(mutexp); return 1; -#elif defined(NETWARE) -#ifdef USE_MPK - return kMutexLock(mutexp); -#else - return NXLock(mutexp); -#endif #elif defined(GNUPTH) return pth_mutex_acquire(mutexp, 0, NULL); #elif defined(PTHREADS) @@ -601,12 +589,6 @@ TSRM_API int tsrm_mutex_unlock(MUTEX_T mutexp) #ifdef TSRM_WIN32 LeaveCriticalSection(mutexp); return 1; -#elif defined(NETWARE) -#ifdef USE_MPK - return kMutexUnlock(mutexp); -#else - return NXUnlock(mutexp); -#endif #elif defined(GNUPTH) return pth_mutex_release(mutexp); #elif defined(PTHREADS) diff --git a/TSRM/threads.m4 b/TSRM/threads.m4 index 11c4230f1..d38841ddf 100644 --- a/TSRM/threads.m4 +++ b/TSRM/threads.m4 @@ -87,7 +87,7 @@ int main() { ], [ dnl For cross compiling running this test is of no use. NetWare supports pthreads pthreads_working=no - case $target_alias in + case $host_alias in *netware*) pthreads_working=yes esac diff --git a/TSRM/tsrm_virtual_cwd.c b/TSRM/tsrm_virtual_cwd.c index b50023b45..88a1bf336 100644 --- a/TSRM/tsrm_virtual_cwd.c +++ b/TSRM/tsrm_virtual_cwd.c @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: tsrm_virtual_cwd.c,v 1.62.2.5 2005/03/11 11:09:42 hyanantha Exp $ */ +/* $Id: tsrm_virtual_cwd.c,v 1.62.2.7 2005/07/16 11:50:59 hyanantha Exp $ */ #include <sys/types.h> #include <sys/stat.h> @@ -42,8 +42,7 @@ #endif #ifdef NETWARE -/*#include "pipe.h"*/ -#include "tsrm_nw.h" +#include <fsio.h> #endif #ifndef HAVE_REALPATH @@ -142,15 +141,9 @@ static int php_check_dots(const char *element, int n) static int php_is_dir_ok(const cwd_state *state) { -#if !(defined(NETWARE) && defined(CLIB_STAT_PATCH)) struct stat buf; if (stat(state->cwd, &buf) == 0 && S_ISDIR(buf.st_mode)) -#else - struct stat_libc buf; - - if (stat(state->cwd, (struct stat*)(&buf)) == 0 && S_ISDIR(buf.st_mode)) -#endif return (0); return (1); @@ -158,15 +151,9 @@ static int php_is_dir_ok(const cwd_state *state) static int php_is_file_ok(const cwd_state *state) { -#if !(defined(NETWARE) && defined(CLIB_STAT_PATCH)) struct stat buf; if (stat(state->cwd, &buf) == 0 && S_ISREG(buf.st_mode)) -#else - struct stat_libc buf; - - if (stat(state->cwd, (struct stat*)(&buf)) == 0 && S_ISREG(buf.st_mode)) -#endif return (0); return (1); @@ -202,7 +189,20 @@ CWD_API void virtual_cwd_startup(void) char cwd[MAXPATHLEN]; char *result; +#ifdef NETWARE + result = getcwdpath(cwd, NULL, 1); + if(result) + { + char *c=cwd; + while(c = strchr(c, '\\')) + { + *c='/'; + ++c; + } + } +#else result = getcwd(cwd, sizeof(cwd)); +#endif if (!result) { cwd[0] = '\0'; } @@ -445,8 +445,19 @@ CWD_API int virtual_file_ex(cwd_state *state, const char *path, verify_path_func state->cwd[state->cwd_length++] = DEFAULT_SLASH; } #elif defined(NETWARE) - /* If the token is a volume name, it will have colon at the end -- so, no slash before it */ - if (ptr[ptr_length-1] != ':') { + /* + Below code keeps appending to state->cwd a File system seperator + cases where this appending should not happen is given below, + a) sys: should just be left as it is + b) sys:system should just be left as it is, + Colon is allowed only in the first token as volume names alone can have the : in their names. + Files and Directories cannot have : in their names + So the check goes like this, + For second token and above simply append the DEFAULT_SLASH to the state->cwd. + For first token check for the existence of : + if it exists don't append the DEFAULT_SLASH to the state->cwd. + */ + if(((state->cwd_length == 0) && (strchr(ptr, ':') == NULL)) || (state->cwd_length > 0)) { state->cwd[state->cwd_length++] = DEFAULT_SLASH; } #else @@ -716,7 +727,6 @@ CWD_API int virtual_rename(char *oldname, char *newname TSRMLS_DC) return retval; } -#if !(defined(NETWARE) && defined(CLIB_STAT_PATCH)) CWD_API int virtual_stat(const char *path, struct stat *buf TSRMLS_DC) { cwd_state new_state; @@ -730,21 +740,6 @@ CWD_API int virtual_stat(const char *path, struct stat *buf TSRMLS_DC) CWD_STATE_FREE(&new_state); return retval; } -#else -CWD_API int virtual_stat(const char *path, struct stat_libc *buf TSRMLS_DC) -{ - cwd_state new_state; - int retval; - - CWD_STATE_COPY(&new_state, &CWDG(cwd)); - virtual_file_ex(&new_state, path, NULL, 1); - - retval = stat(new_state.cwd, (struct stat*)buf); - - CWD_STATE_FREE(&new_state); - return retval; -} -#endif #ifndef TSRM_WIN32 CWD_API int virtual_lstat(const char *path, struct stat *buf TSRMLS_DC) diff --git a/TSRM/tsrm_virtual_cwd.h b/TSRM/tsrm_virtual_cwd.h index c4fd23ef1..e14c2c220 100644 --- a/TSRM/tsrm_virtual_cwd.h +++ b/TSRM/tsrm_virtual_cwd.h @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: tsrm_virtual_cwd.h,v 1.42.2.1 2005/03/11 11:07:17 hyanantha Exp $ */ +/* $Id: tsrm_virtual_cwd.h,v 1.42.2.3 2005/07/16 11:50:59 hyanantha Exp $ */ #ifndef VIRTUAL_CWD_H #define VIRTUAL_CWD_H @@ -74,10 +74,8 @@ typedef unsigned short mode_t; #define DEFAULT_DIR_SEPARATOR ';' #define IS_SLASH(c) ((c) == '/' || (c) == '\\') #define IS_SLASH_P(c) IS_SLASH(*(c)) -#define COPY_WHEN_ABSOLUTE(path) \ - (strchr(path, ':') - path + 1) /* Take the volume name which ends with a colon */ #define IS_ABSOLUTE_PATH(path, len) \ - (strchr(path, ':') != NULL) /* Colon indicates volume name */ + ((strchr(path, ':') != NULL) || ((len >= 1) && ((path[0] == '/') || (path[0] == '\\')))) #else #ifdef HAVE_DIRENT_H @@ -141,11 +139,7 @@ CWD_API FILE *virtual_fopen(const char *path, const char *mode TSRMLS_DC); CWD_API int virtual_open(const char *path TSRMLS_DC, int flags, ...); CWD_API int virtual_creat(const char *path, mode_t mode TSRMLS_DC); CWD_API int virtual_rename(char *oldname, char *newname TSRMLS_DC); -#if !(defined(NETWARE) && defined(CLIB_STAT_PATCH)) CWD_API int virtual_stat(const char *path, struct stat *buf TSRMLS_DC); -#else -CWD_API int virtual_stat(const char *path, struct stat_libc *buf TSRMLS_DC); -#endif #if !defined(TSRM_WIN32) && !defined(NETWARE) CWD_API int virtual_lstat(const char *path, struct stat *buf TSRMLS_DC); #endif |