Browse Source

Don't call Rast_unopen() on invalid R__.mask_fd

git-svn-id: https://svn.osgeo.org/grass/grass/trunk@40419 15284696-431f-4ddb-bdfa-cd5b030d7da7
Glynn Clements 15 years ago
parent
commit
5f835ec5b8
2 changed files with 3 additions and 1 deletions
  1. 2 1
      lib/raster/auto_mask.c
  2. 1 0
      lib/raster/init.c

+ 2 - 1
lib/raster/auto_mask.c

@@ -61,7 +61,8 @@ int Rast__check_for_auto_masking(void)
 	return 0;
 	return 0;
     }
     }
 
 
-    Rast_unopen(R__.mask_fd);
+    if (R__.mask_fd >= 0)
+	Rast_unopen(R__.mask_fd);
     R__.mask_fd = Rast__open_old("MASK", G_mapset());
     R__.mask_fd = Rast__open_old("MASK", G_mapset());
     if (R__.mask_fd < 0) {
     if (R__.mask_fd < 0) {
 	R__.auto_mask = 0;
 	R__.auto_mask = 0;

+ 1 - 0
lib/raster/init.c

@@ -83,6 +83,7 @@ static int init(void)
 
 
     /* Set masking flag unknown */
     /* Set masking flag unknown */
     R__.auto_mask = -1;
     R__.auto_mask = -1;
+    R__.mask_fd = -1;
 
 
     R__.nbytes = sizeof(CELL);
     R__.nbytes = sizeof(CELL);
     R__.compression_type = getenv("GRASS_INT_ZLIB") ? 2 : 1;
     R__.compression_type = getenv("GRASS_INT_ZLIB") ? 2 : 1;