httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From wr...@locus.apache.org
Subject cvs commit: apache-1.3/src/modules/proxy proxy_cache.c
Date Thu, 01 Jun 2000 17:51:27 GMT
wrowe       00/06/01 10:51:27

  Modified:    src      CHANGES
               src/modules/proxy proxy_cache.c
  Log:
  PR:             1891, 3278, 4139, 5997
  Obtained from:  PR 1439
  Submitted by:	Michael Friedel <mfriedel@lbell.slctnet.com>
  Reviewed by:	William Rowe
  
    Time for this to go away.  Fixes proxy garbage collection fault in Win32
    due to stat() against directory.
  
  Revision  Changes    Path
  1.1543    +5 -0      apache-1.3/src/CHANGES
  
  Index: CHANGES
  ===================================================================
  RCS file: /home/cvs/apache-1.3/src/CHANGES,v
  retrieving revision 1.1542
  retrieving revision 1.1543
  diff -u -r1.1542 -r1.1543
  --- CHANGES	2000/05/25 16:45:45	1.1542
  +++ CHANGES	2000/06/01 17:51:23	1.1543
  @@ -1,5 +1,10 @@
   Changes with Apache 1.3.13
   
  +  *) Correct mod_proxy Win32 garbage collection bug (clean failing
  +     due to stat() against directory).
  +     PR: 1891, 3278, 4139, 5997
  +     [Michael Friedel <mfriedel@lbell.slctnet.com>]
  +
     *) Add '-n' option to htpasswd to make it print its user:pw record
        on stdout rather than having to frob a text file.  [Ken Coar]
   
  
  
  
  1.67      +31 -2     apache-1.3/src/modules/proxy/proxy_cache.c
  
  Index: proxy_cache.c
  ===================================================================
  RCS file: /home/cvs/apache-1.3/src/modules/proxy/proxy_cache.c,v
  retrieving revision 1.66
  retrieving revision 1.67
  diff -u -r1.66 -r1.67
  --- proxy_cache.c	2000/03/01 09:13:38	1.66
  +++ proxy_cache.c	2000/06/01 17:51:26	1.67
  @@ -499,7 +499,19 @@
   #endif
   
   /* read the file */
  -	fd = open(filename, O_RDONLY | O_BINARY);
  +#if defined(WIN32)
  +        /* On WIN32 open does not work for directories, 
  +         * so we us stat instead of fstat to determine 
  +         * if the file is a directory 
  +         */
  +        if (stat(filename, &buf) == -1) {
  +            ap_log_error(APLOG_MARK, APLOG_ERR, r->server,
  +        		 "proxy gc: stat(%s)", filename);
  +            continue;
  +        }
  +        fd = -1;
  +#else
  + 	fd = open(filename, O_RDONLY | O_BINARY);
   	if (fd == -1) {
   	    if (errno != ENOENT)
   		ap_log_error(APLOG_MARK, APLOG_ERR, r->server,
  @@ -512,12 +524,16 @@
   	    close(fd);
   	    continue;
   	}
  +#endif
   
   /* In OS/2 and TPF this has already been done above */
   #if !defined(OS2) && !defined(TPF)
   	if (S_ISDIR(buf.st_mode)) {
   	    char newcachedir[HUGE_STRING_LEN];
  -	    close(fd);
  +#if !defined(WIN32)
  +            /* Win32 used stat, no file to close */
  +            close(fd);
  +#endif
   	    ap_snprintf(newcachedir, sizeof(newcachedir),
   			"%s%s/", cachesubdir, ent->d_name);
   	    if (!sub_garbage_coll(r, files, cachebasedir, newcachedir)) {
  @@ -537,6 +553,19 @@
   	}
   #endif
   
  +#if defined(WIN32)
  +        /* Since we have determined above that the file is not a directory,
  +         * it should be safe to open it now 
  +         */
  +        fd = open(filename, O_RDONLY | O_BINARY);
  +        if (fd == -1) {
  +            if (errno != ENOENT)
  +	        ap_log_error(APLOG_MARK, APLOG_ERR, r->server,
  +		             "proxy gc: open(%s) = %d", filename, errno);
  +            continue;
  +        }
  +#endif
  + 
   	i = read(fd, line, 26);
   	close(fd);
   	if (i == -1) {
  
  
  

Mime
View raw message