[GRASS-SVN] r36227 - grass/trunk/lib/gis
svn_grass at osgeo.org
svn_grass at osgeo.org
Sat Mar 7 03:07:32 EST 2009
Author: neteler
Date: 2009-03-07 03:07:32 -0500 (Sat, 07 Mar 2009)
New Revision: 36227
Modified:
grass/trunk/lib/gis/mapset_msc.c
Log:
print error when failing
Modified: grass/trunk/lib/gis/mapset_msc.c
===================================================================
--- grass/trunk/lib/gis/mapset_msc.c 2009-03-07 00:19:09 UTC (rev 36226)
+++ grass/trunk/lib/gis/mapset_msc.c 2009-03-07 08:07:32 UTC (rev 36227)
@@ -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