cvs: TSRM / tsrm_virtual_cwd.c

From: Date: Fri, 08 Oct 2004 08:59:13 +0000
Subject: cvs: TSRM / tsrm_virtual_cwd.c
Groups: php.zend-engine.cvs 
Request: Send a blank email to php-zend-engine-cvs+get-3086@lists.php.net to get a copy of this message
hyanantha Fri Oct 8 04:59:13 2004 EDT Modified files: /TSRM tsrm_virtual_cwd.c Log: removed redundant NEW_LIBC checks and added the code to recognize the file naming convention in NetWare(supports Windows based drive names like sys: data: and unix like / (sys: being root) http://cvs.php.net/diff.php/TSRM/tsrm_virtual_cwd.c?r1=1.64&r2=1.65&ty=u Index: TSRM/tsrm_virtual_cwd.c diff -u TSRM/tsrm_virtual_cwd.c:1.64 TSRM/tsrm_virtual_cwd.c:1.65 --- TSRM/tsrm_virtual_cwd.c:1.64 Wed Oct 6 19:56:29 2004 +++ TSRM/tsrm_virtual_cwd.c Fri Oct 8 04:59:11 2004 @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: tsrm_virtual_cwd.c,v 1.64 2004/10/06 23:56:29 iliaa Exp $ */ +/* $Id: tsrm_virtual_cwd.c,v 1.65 2004/10/08 08:59:11 hyanantha Exp $ */ #include <sys/types.h> #include <sys/stat.h> @@ -42,11 +42,6 @@ # endif #endif -#ifdef NETWARE -/*#include "pipe.h"*/ -#include "tsrm_nw.h" -#endif - #ifndef HAVE_REALPATH #define realpath(x,y) strcpy(y,x) #endif @@ -143,15 +138,9 @@ 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); @@ -159,15 +148,9 @@ 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); @@ -547,8 +530,19 @@ 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 @@ -822,7 +816,6 @@ 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; @@ -836,21 +829,6 @@ 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 #if !defined(TSRM_WIN32) && !defined(NETWARE) CWD_API int virtual_lstat(const char *path, struct stat *buf TSRMLS_DC)

« previous php.zend-engine.cvs (#3086) next »