[mapserver-commits] r13267 - trunk/mapserver/mapcache/lib

svn at osgeo.org svn at osgeo.org
Fri Mar 16 08:32:04 EDT 2012


Author: tbonfort
Date: 2012-03-16 05:32:04 -0700 (Fri, 16 Mar 2012)
New Revision: 13267

Modified:
   trunk/mapserver/mapcache/lib/cache_disk.c
Log:
use stat instead of open to test for tile existence


Modified: trunk/mapserver/mapcache/lib/cache_disk.c
===================================================================
--- trunk/mapserver/mapcache/lib/cache_disk.c	2012-03-15 22:14:55 UTC (rev 13266)
+++ trunk/mapserver/mapcache/lib/cache_disk.c	2012-03-16 12:32:04 UTC (rev 13267)
@@ -145,17 +145,18 @@
 
 static int _mapcache_cache_disk_has_tile(mapcache_context *ctx, mapcache_tile *tile) {
    char *filename;
-   apr_file_t *f;
+   apr_finfo_t finfo;
+   int rv;
    _mapcache_cache_disk_tile_key(ctx, tile, &filename);
    if(GC_HAS_ERROR(ctx)) {
       return MAPCACHE_FALSE;
    }
-   if(apr_file_open(&f, filename, APR_FOPEN_READ,APR_OS_DEFAULT, ctx->pool) == APR_SUCCESS) {
-      apr_file_close(f);
+   rv = apr_stat(&finfo,filename,0,ctx->pool);
+   if(rv != APR_SUCCESS) {
+      return MAPCACHE_FALSE;
+   } else {
       return MAPCACHE_TRUE;
    }
-   else
-      return MAPCACHE_FALSE;
 }
 
 static void _mapcache_cache_disk_delete(mapcache_context *ctx, mapcache_tile *tile) {



More information about the mapserver-commits mailing list