summaryrefslogtreecommitdiff
path: root/file_io/netware
diff options
context:
space:
mode:
authorbnicholes <bnicholes@13f79535-47bb-0310-9956-ffa450edef68>2003-05-08 16:44:08 +0000
committerbnicholes <bnicholes@13f79535-47bb-0310-9956-ffa450edef68>2003-05-08 16:44:08 +0000
commit6ddfea24db00044ce7639e45051533135acf9d0d (patch)
treedd759e0d6eeed30b7ceb02785afd87057d202b16 /file_io/netware
parent18ac4f07ca104c7d5615697faf72e92e7fec9b87 (diff)
downloadlibapr-6ddfea24db00044ce7639e45051533135acf9d0d.tar.gz
Make sure that the current directory that is represented by the context is stat'ed
if the resulting path is a single slash. git-svn-id: http://svn.apache.org/repos/asf/apr/apr/trunk@64502 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'file_io/netware')
-rw-r--r--file_io/netware/filestat.c20
1 files changed, 18 insertions, 2 deletions
diff --git a/file_io/netware/filestat.c b/file_io/netware/filestat.c
index de5e13932..3bee79d4a 100644
--- a/file_io/netware/filestat.c
+++ b/file_io/netware/filestat.c
@@ -62,6 +62,8 @@
#include "apr_hash.h"
#include "apr_thread_rwlock.h"
+/*#define APR_HAS_PSA*/
+
static apr_filetype_e filetype_from_mode(mode_t mode)
{
apr_filetype_e type = APR_NOFILE;
@@ -192,6 +194,7 @@ APR_DECLARE(apr_status_t) apr_file_attrs_set(const char *fname,
return apr_file_perms_set(fname, finfo.protection);
}
+#ifndef APR_HAS_PSA
static apr_status_t stat_cache_cleanup(void *data)
{
apr_pool_t *p = (apr_pool_t *)getGlobalPool();
@@ -270,7 +273,16 @@ int cstat (NXPathCtx_t ctx, char *path, struct stat *buf, unsigned long requestm
if (ptr[1] != '\0') {
ptr++;
}
- pinfo = apr_pstrdup (p, ptr);
+ /* If the path ended in a trailing slash then our result path
+ will be a single slash. To avoid stat'ing the root with a
+ slash, we need to make sure we stat the current directory
+ with a dot */
+ if (((*ptr == '/') || (*ptr == '\\')) && (*(ptr+1) == '\0')) {
+ pinfo = apr_pstrdup (p, ".");
+ }
+ else {
+ pinfo = apr_pstrdup (p, ptr);
+ }
}
/* If we have a statCache then try to pull the information
@@ -297,7 +309,7 @@ int cstat (NXPathCtx_t ctx, char *path, struct stat *buf, unsigned long requestm
}
return getstat(ctx, path, buf, requestmap);
}
-
+#endif
APR_DECLARE(apr_status_t) apr_stat(apr_finfo_t *finfo,
const char *fname,
@@ -308,7 +320,11 @@ APR_DECLARE(apr_status_t) apr_stat(apr_finfo_t *finfo,
NXPathCtx_t pathCtx = 0;
getcwdpath(NULL, &pathCtx, CTX_ACTUAL_CWD);
+#ifdef APR_HAS_PSA
+ srv = getstat(pathCtx, (char*)fname, &info, ST_STAT_BITS|ST_NAME_BIT);
+#else
srv = cstat(pathCtx, (char*)fname, &info, ST_STAT_BITS|ST_NAME_BIT, pool);
+#endif
errno = srv;
if (srv == 0) {