Bladeren bron

libgis: call fatal error when unable to read GISRC file

git-svn-id: https://svn.osgeo.org/grass/grass/trunk@67044 15284696-431f-4ddb-bdfa-cd5b030d7da7
Martin Landa 9 jaren geleden
bovenliggende
commit
9eec0f49b3
1 gewijzigde bestanden met toevoegingen van 8 en 0 verwijderingen
  1. 8 0
      lib/gis/env.c

+ 8 - 0
lib/gis/env.c

@@ -17,6 +17,8 @@
 #include <stdlib.h>
 #include <stdlib.h>
 #include <unistd.h>		/* for sleep() */
 #include <unistd.h>		/* for sleep() */
 #include <string.h>
 #include <string.h>
+#include <errno.h>
+
 #include <grass/gis.h>
 #include <grass/gis.h>
 #include <grass/glocale.h>
 #include <grass/glocale.h>
 
 
@@ -151,6 +153,9 @@ static int read_env(int loc)
         fclose(fd);
         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]);
     G_initialize_done(&st->init[loc]);
     return 0;
     return 0;
 }
 }
@@ -167,6 +172,9 @@ static void force_read_env(int loc)
         parse_env(fd, loc);
         parse_env(fd, loc);
         fclose(fd);
         fclose(fd);
     }
     }
+    
+    if (!fd) /* reading failed, call fatal error */
+      G_fatal_error(_("Unable to read GISRC <%s>: %s"), loc, strerror(errno));
 }
 }