[GRASS-SVN] r36229 - grass/branches/releasebranch_6_4/lib/gis

svn_grass at osgeo.org svn_grass at osgeo.org
Sat Mar 7 03:08:00 EST 2009


Author: neteler
Date: 2009-03-07 03:08:00 -0500 (Sat, 07 Mar 2009)
New Revision: 36229

Modified:
   grass/branches/releasebranch_6_4/lib/gis/mapset_msc.c
Log:
print error when failing

Modified: grass/branches/releasebranch_6_4/lib/gis/mapset_msc.c
===================================================================
--- grass/branches/releasebranch_6_4/lib/gis/mapset_msc.c	2009-03-07 08:07:48 UTC (rev 36228)
+++ grass/branches/releasebranch_6_4/lib/gis/mapset_msc.c	2009-03-07 08:08:00 UTC (rev 36229)
@@ -12,6 +12,7 @@
 #include <string.h>
 #include <unistd.h>
 #include <stdlib.h>
+#include <errno.h>
 #include <sys/types.h>
 #include <sys/stat.h>
 #include <grass/gis.h>
@@ -54,11 +55,14 @@
     while (1) {
 	if (*element == '/' || *element == 0) {
 	    *p = 0;
-	    if (access(path, 0) != 0)
-		G_mkdir(path);
-	    if (access(path, 0) != 0)
-		G_fatal_error(_("Unable to make mapset element %s (%s)"),
-			      p_element, path);
+	    if (access(path, 0) != 0) { /* directory not yet created */
+		if (G_mkdir(path) != 0)
+		    G_fatal_error(_("Unable to make mapset element %s (%s): %s"),
+				  p_element, path, strerror(errno));
+	    }
+	    if (access(path, 0) != 0)  /* directory not accessible */
+		G_fatal_error(_("Unable to make mapset element %s (%s): %s"),
+			      p_element, path, strerror(errno));
 	    if (*element == 0)
 		return 1;
 	}



More information about the grass-commit mailing list