apr-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bnicho...@apache.org
Subject cvs commit: apr/file_io/netware filestat.c
Date Mon, 06 Jan 2003 19:15:40 GMT
bnicholes    2003/01/06 11:15:40

  Modified:    file_io/unix open.c
               file_io/netware filestat.c
  Log:
  NETWARE: Only use the path context from the stat cache if the request
  thread is running with the server identity.
  
  Revision  Changes    Path
  1.106     +11 -3     apr/file_io/unix/open.c
  
  Index: open.c
  ===================================================================
  RCS file: /home/cvs/apr/file_io/unix/open.c,v
  retrieving revision 1.105
  retrieving revision 1.106
  diff -u -r1.105 -r1.106
  --- open.c	1 Jan 2003 00:01:43 -0000	1.105
  +++ open.c	6 Jan 2003 19:15:39 -0000	1.106
  @@ -106,8 +106,10 @@
   #endif
   
   #ifdef NETWARE
  -    apr_hash_t *statCache = (apr_hash_t *)getStatCache(CpuCurrentProcessor);
  +    apr_hash_t *statCache = NULL;
       apr_stat_entry_t *stat_entry = NULL;
  +    NXPathCtx_t pathCtx = 0;
  +    int identity;
   #endif
   
       if ((flag & APR_READ) && (flag & APR_WRITE)) {
  @@ -156,9 +158,15 @@
   #endif
   
   #ifdef NETWARE
  -    if (statCache) {
  -        stat_entry = (apr_stat_entry_t*) apr_hash_get(statCache, fname, APR_HASH_KEY_STRING);
  +    if (!getcwdpath(NULL, &pathCtx, CTX_ACTUAL_CWD) &&
  +        !get_identity (pathCtx, &identity) && !identity) {
  +
  +        statCache = (apr_hash_t *)getStatCache(CpuCurrentProcessor);
  +        if (statCache) {
  +            stat_entry = (apr_stat_entry_t*) apr_hash_get(statCache, fname, APR_HASH_KEY_STRING);
  +        }
       }
  +
       if (stat_entry) {
           errno = NXFileOpen (stat_entry->pathCtx, stat_entry->casedName, oflags, &fd);
       }
  
  
  
  1.22      +17 -9     apr/file_io/netware/filestat.c
  
  Index: filestat.c
  ===================================================================
  RCS file: /home/cvs/apr/file_io/netware/filestat.c,v
  retrieving revision 1.21
  retrieving revision 1.22
  diff -u -r1.21 -r1.22
  --- filestat.c	1 Jan 2003 00:01:42 -0000	1.21
  +++ filestat.c	6 Jan 2003 19:15:40 -0000	1.22
  @@ -184,14 +184,13 @@
       return apr_file_perms_set(fname, finfo.protection);
   }
   
  -int cstat (const char *path, struct stat *buf, char **casedName, apr_pool_t *pool)
  +int cstat (NXPathCtx_t pathCtx, const char *path, struct stat *buf, char **casedName, apr_pool_t
*pool)
   {
       apr_hash_t *statCache = (apr_hash_t *)getStatCache(CpuCurrentProcessor);
       apr_pool_t *gPool = (apr_pool_t *)getGlobalPool(CpuCurrentProcessor);
       apr_stat_entry_t *stat_entry;
       struct stat *info;
       apr_time_t now = apr_time_now();
  -    NXPathCtx_t pathCtx = 0;
       char *key;
       int ret;
       int found = 0;
  @@ -205,7 +204,6 @@
           char poolname[50];
   
           if (apr_pool_create(&gPool, NULL) != APR_SUCCESS) {
  -            getcwdpath(NULL, &pathCtx, CTX_ACTUAL_CWD);
               ret = getstat(pathCtx, path, buf, ST_STAT_BITS|ST_NAME_BIT);
               if (ret == 0) {
                   *casedName = apr_pstrdup (pool, buf->st_name);
  @@ -259,9 +257,7 @@
                   char *dirPath = NULL, *fname = NULL;
                   char *ptr;
                   int err, len;
  -                char pathbuf[256];
   
  -                getcwdpath(pathbuf, &pathCtx, CTX_ACTUAL_CWD);
                   ret = getstat(pathCtx, path, buf, ST_STAT_BITS|ST_NAME_BIT);
   
                   if (ret) {
  @@ -309,8 +305,6 @@
                                     ST_MODE_BIT|ST_ATIME_BIT|ST_MTIME_BIT|ST_CTIME_BIT|ST_SIZE_BIT|ST_NAME_BIT);
                   }
                   else {
  -                    char pathbuf[256];
  -                    getcwdpath(pathbuf, &pathCtx, CTX_ACTUAL_CWD);
                       ret = getstat(pathCtx, path, buf, 
                                     ST_MODE_BIT|ST_ATIME_BIT|ST_MTIME_BIT|ST_CTIME_BIT|ST_SIZE_BIT|ST_NAME_BIT);
                   }
  @@ -339,7 +333,6 @@
           }
       }
       else {
  -        getcwdpath(NULL, &pathCtx, CTX_ACTUAL_CWD);
           ret = getstat(pathCtx, path, buf, ST_STAT_BITS|ST_NAME_BIT);
           if (ret == 0) {
               *casedName = apr_pstrdup(pool, buf->st_name);
  @@ -359,8 +352,23 @@
       struct stat info;
       int srv;
       char *casedName = NULL;
  +    NXPathCtx_t pathCtx = 0;
  +    int identity;
  +    int ret;
  +
  +    getcwdpath(NULL, &pathCtx, CTX_ACTUAL_CWD);
  +    ret= get_identity (pathCtx, &identity);
   
  -    srv = cstat(fname, &info, &casedName, pool);
  +    if (ret || identity) {
  +        srv = getstat(pathCtx, fname, &info, ST_STAT_BITS|ST_NAME_BIT);
  +        if (srv == 0) {
  +            casedName = apr_pstrdup(pool, info.st_name);
  +        }
  +        errno = srv;
  +    }
  +    else {
  +        srv = cstat(pathCtx, fname, &info, &casedName, pool);
  +    }
   
       if (srv == 0) {
           finfo->pool = pool;
  
  
  

Mime
View raw message