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

svn_grass at osgeo.org svn_grass at osgeo.org
Sat Mar 7 03:07:48 EST 2009


Author: neteler
Date: 2009-03-07 03:07:48 -0500 (Sat, 07 Mar 2009)
New Revision: 36228

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

Modified: grass/branches/develbranch_6/lib/gis/mapset_msc.c
===================================================================
--- grass/branches/develbranch_6/lib/gis/mapset_msc.c	2009-03-07 08:07:32 UTC (rev 36227)
+++ grass/branches/develbranch_6/lib/gis/mapset_msc.c	2009-03-07 08:07:48 UTC (rev 36228)
@@ -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