Doug MacEachern wrote:

> On Tue, 13 Nov 2001, Stas Bekman wrote:
>  
> 
>>ap_server_root_relative return the dir incliding the trailing / if
>>fname==NULL, which is bad. 
>>
> 
> need to do some research here:
> - what does 1.x do?  if adds trailing /, then leave it alone


I've tested, it has a trailing /


It's possible that nobody used this before, so the bogosity wasn't noticed. 


The header doesn't define the case where fname == NULL:

/**
  * For modules which need to read config files, open logs, etc. this 
returns
  * the canonical form of fname made absolute to ap_server_root.
  * @param p pool to allocate data from
  * @param fname The file name
  */
AP_DECLARE(char *) ap_server_root_relative(apr_pool_t *p, const char 
*fname);

Do you think this patch makes sense? or should this be handled on the 
apr_filepath_merge level?

Index: server/config.c
===================================================================
RCS file: /home/cvspublic/httpd-2.0/server/config.c,v
retrieving revision 1.136
diff -u -r1.136 config.c
--- server/config.c     2001/10/07 04:54:53     1.136
+++ server/config.c     2001/11/14 08:15:10
@@ -1184,7 +1184,9 @@
  AP_DECLARE(char *) ap_server_root_relative(apr_pool_t *p, const char 
*file)
  {
      char *newpath;
-    if (apr_filepath_merge(&newpath, ap_server_root, file,
+    if (!file)
+        return ap_server_root;
+    else if (apr_filepath_merge(&newpath, ap_server_root, file,
                             APR_FILEPATH_TRUENAME, p) == APR_SUCCESS)
          return newpath;
      else

_____________________________________________________________________
Stas Bekman             JAm_pH      --   Just Another mod_perl Hacker
http://stason.org/      mod_perl Guide   http://perl.apache.org/guide
mailto:[EMAIL PROTECTED]  http://ticketmaster.com http://apacheweek.com
http://singlesheaven.com http://perl.apache.org http://perlmonth.com/


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to