[GRASS-SVN] r50588 - grass/branches/develbranch_6/lib/gis

svn_grass at osgeo.org svn_grass at osgeo.org
Tue Jan 31 09:51:57 EST 2012


Author: hamish
Date: 2012-01-31 06:51:56 -0800 (Tue, 31 Jan 2012)
New Revision: 50588

Modified:
   grass/branches/develbranch_6/lib/gis/closecell.c
Log:
only try to remove raster map elements if they actually exist. (some more)

Modified: grass/branches/develbranch_6/lib/gis/closecell.c
===================================================================
--- grass/branches/develbranch_6/lib/gis/closecell.c	2012-01-31 13:31:56 UTC (rev 50587)
+++ grass/branches/develbranch_6/lib/gis/closecell.c	2012-01-31 14:51:56 UTC (rev 50588)
@@ -230,9 +230,11 @@
 			  fcb->null_temp_name, path);
 		stat = -1;
 	    }
-	    else {
-		if (remove(fcb->null_temp_name) != 0)
-		    G_warning(_("Unable to delete the temporary null-cells file"));
+	    else { /* if the rename() was successful I'm not sure why there'd be anything left to remove() */
+		if (access(fcb->null_temp_name, F_OK) == 0) {
+		    if (remove(fcb->null_temp_name) != 0)
+			G_warning(_("Unable to delete the temporary null-cells file"));
+		}
 	    }
 	}
 	else { /* no NULL data encountered */
@@ -331,9 +333,11 @@
 		      fcb->temp_name, path);
 	    stat = -1;
 	}
-	else {
-	    if (remove(fcb->temp_name) != 0)
-		G_warning(_("Unable to delete the temporary 'cell' file"));
+	else { /* if the rename() was successful I'm not sure why there'd be anything left to remove() */
+	    if (access(fcb->temp_name, F_OK) == 0) {
+		if (remove(fcb->temp_name) != 0)
+		    G_warning(_("Unable to delete the temporary 'cell' file"));
+	    }
 	}
     }
 
@@ -389,8 +393,10 @@
 	    /* remove cell_misc/name/f_quant */
 	    G__file_name_misc(path, "cell_misc", QUANT_FILE, fcb->name,
 			      fcb->mapset);
-	    if (remove(path) != 0)
-		G_warning(_("Unable to delete the %s file"), QUANT_FILE);
+	    if (access(path, F_OK) == 0) {
+		if (remove(path) != 0)
+		    G_warning(_("Unable to delete the %s file"), QUANT_FILE);
+	    }
 	}
 
 	/* create empty cats file */



More information about the grass-commit mailing list