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 filesys.c
Date Fri, 20 Dec 2002 18:59:32 GMT
bnicholes    2002/12/20 10:59:32

  Modified:    file_io/netware filesys.c
  Log:
  Use getcwdpath() rather than getcwd() in apr_filepath_get() to make sure that
  the resulting path includes a volume name.
  
  Revision  Changes    Path
  1.5       +13 -3     apr/file_io/netware/filesys.c
  
  Index: filesys.c
  ===================================================================
  RCS file: /home/cvs/apr/file_io/netware/filesys.c,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- filesys.c	13 Mar 2002 20:39:10 -0000	1.4
  +++ filesys.c	20 Dec 2002 18:59:32 -0000	1.5
  @@ -106,16 +106,26 @@
                                              apr_pool_t *p)
   {
       char path[APR_PATH_MAX];
  -    if (!getcwd(path, sizeof(path))) {
  +    char *ptr;
  +
  +    /* use getcwdpath to make sure that we get the volume name*/
  +    if (!getcwdpath(path, NULL, 0)) {
           if (errno == ERANGE)
               return APR_ENAMETOOLONG;
           else
               return errno;
       }
  -    *rootpath = apr_pstrdup(p, path);
  +    /* Strip off the server name if there is one*/
  +    ptr = strpbrk(path, "\\/:");
  +    if (!ptr) {
  +        return APR_ENOENT;
  +    }
  +    if (*ptr == ':') {
  +        ptr = path;
  +    }
  +    *rootpath = apr_pstrdup(p, ptr);
       return APR_SUCCESS;
   }
  -
   
   APR_DECLARE(apr_status_t) apr_filepath_set(const char *rootpath,
                                              apr_pool_t *p)
  
  
  

Mime
View raw message