[GRASS-SVN] r65775 - grass/trunk/lib/raster

svn_grass at osgeo.org svn_grass at osgeo.org
Thu Jul 23 05:07:49 PDT 2015


Author: glynn
Date: 2015-07-23 05:07:49 -0700 (Thu, 23 Jul 2015)
New Revision: 65775

Modified:
   grass/trunk/lib/raster/close.c
Log:
Close null file before attempting to rename() it (issue #2712)


Modified: grass/trunk/lib/raster/close.c
===================================================================
--- grass/trunk/lib/raster/close.c	2015-07-22 17:17:35 UTC (rev 65774)
+++ grass/trunk/lib/raster/close.c	2015-07-23 12:07:49 UTC (rev 65775)
@@ -362,6 +362,15 @@
 	    fcb->data = NULL;
 	}
 
+	if (fcb->null_row_ptr) {			/* compressed nulls */
+	    fcb->null_row_ptr[fcb->cellhd.rows] = lseek(fcb->null_fd, 0L, SEEK_CUR);
+	    Rast__write_null_row_ptrs(fd, fcb->null_fd);
+	}
+
+	if (fcb->null_fd >= 0)
+	    close(fcb->null_fd);
+	fcb->null_fd = -1;
+
 	/* create path : full null file name */
 	G__make_mapset_element_misc("cell_misc", fcb->name);
 	G_file_name_misc(path, "cell_misc", NULL_FILE, fcb->name, G_mapset());
@@ -395,11 +404,6 @@
 	    Rast__write_row_ptrs(fd);
 	}
 
-	if (fcb->null_row_ptr) {			/* compressed nulls */
-	    fcb->null_row_ptr[fcb->cellhd.rows] = lseek(fcb->null_fd, 0L, SEEK_CUR);
-	    Rast__write_null_row_ptrs(fd, fcb->null_fd);
-	}
-
 	if (fcb->map_type != CELL_TYPE) {	/* floating point map */
 	    int cell_fd;
 



More information about the grass-commit mailing list