[GRASS-SVN] r67044 - grass/trunk/lib/gis

svn_grass at osgeo.org svn_grass at osgeo.org
Wed Dec 9 06:05:05 PST 2015


Author: martinl
Date: 2015-12-09 06:05:05 -0800 (Wed, 09 Dec 2015)
New Revision: 67044

Modified:
   grass/trunk/lib/gis/env.c
Log:
libgis: call fatal error when unable to read GISRC file

Modified: grass/trunk/lib/gis/env.c
===================================================================
--- grass/trunk/lib/gis/env.c	2015-12-09 14:00:26 UTC (rev 67043)
+++ grass/trunk/lib/gis/env.c	2015-12-09 14:05:05 UTC (rev 67044)
@@ -17,6 +17,8 @@
 #include <stdlib.h>
 #include <unistd.h>		/* for sleep() */
 #include <string.h>
+#include <errno.h>
+
 #include <grass/gis.h>
 #include <grass/glocale.h>
 
@@ -151,6 +153,9 @@
         fclose(fd);
     }
 
+    if (!fd) /* reading failed, call fatal error */
+      G_fatal_error(_("Unable to read GISRC <%s>: %s"), loc, strerror(errno));
+
     G_initialize_done(&st->init[loc]);
     return 0;
 }
@@ -167,6 +172,9 @@
         parse_env(fd, loc);
         fclose(fd);
     }
+    
+    if (!fd) /* reading failed, call fatal error */
+      G_fatal_error(_("Unable to read GISRC <%s>: %s"), loc, strerror(errno));
 }
 
 



More information about the grass-commit mailing list