summaryrefslogtreecommitdiff
path: root/TSRM
diff options
context:
space:
mode:
authorAnantha Kesari H Y <hyanantha@php.net>2004-10-08 08:59:11 +0000
committerAnantha Kesari H Y <hyanantha@php.net>2004-10-08 08:59:11 +0000
commita980f7babe199bce957605707e34f99a3a0cc4cf (patch)
tree8cc58397e8b9c00860855b2092e4a1d3269e0b0c /TSRM
parent7ab517bcbfb30eb768c7bca02a1a540e7e9a0092 (diff)
downloadphp-git-a980f7babe199bce957605707e34f99a3a0cc4cf.tar.gz
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)
Diffstat (limited to 'TSRM')
-rw-r--r--TSRM/tsrm_virtual_cwd.c48
1 files changed, 13 insertions, 35 deletions
diff --git a/TSRM/tsrm_virtual_cwd.c b/TSRM/tsrm_virtual_cwd.c
index fbdd1c0fd4..67e9127ed4 100644
--- a/TSRM/tsrm_virtual_cwd.c
+++ b/TSRM/tsrm_virtual_cwd.c
@@ -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_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);
@@ -159,15 +148,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);
@@ -547,8 +530,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
@@ -822,7 +816,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;
@@ -836,21 +829,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
#if !defined(TSRM_WIN32) && !defined(NETWARE)
CWD_API int virtual_lstat(const char *path, struct stat *buf TSRMLS_DC)