Browse Source

temporal library: Better environment management

git-svn-id: https://svn.osgeo.org/grass/grass/trunk@61997 15284696-431f-4ddb-bdfa-cd5b030d7da7
Soeren Gebbert 10 years ago
parent
commit
7165e74de7
1 changed files with 6 additions and 5 deletions
  1. 6 5
      lib/temporal/lib/connect.c

+ 6 - 5
lib/temporal/lib/connect.c

@@ -90,11 +90,12 @@ int tgis_get_connection(dbConnection * connection)
 static char *get_mapset_connection_name(const char *mapset, int contype)
 static char *get_mapset_connection_name(const char *mapset, int contype)
 {
 {
     const char *val = NULL;
     const char *val = NULL;
-    char *ret_val = NULL;
+    char *ret_val = NULL;;
+    const char *gisdbase = G__getenv("GISDBASE");
+    const char *location = G__getenv("LOCATION_NAME");
     int ret;
     int ret;
 
 
-    ret = G__mapset_permissions2(G__getenv("GISDBASE"), 
-                                 G__getenv("LOCATION_NAME"), mapset);
+    ret = G__mapset_permissions2(gisdbase, location, mapset);
     switch (ret) {
     switch (ret) {
     case 0:
     case 0:
         G_warning(_("You don't have permission to access the mapset <%s>"),
         G_warning(_("You don't have permission to access the mapset <%s>"),
@@ -109,8 +110,8 @@ static char *get_mapset_connection_name(const char *mapset, int contype)
     }    
     }    
 
 
     G_create_alt_env();
     G_create_alt_env();
-    G__setenv("GISDBASE", G_gisdbase());
-    G__setenv("LOCATION_NAME", G_location());
+    G__setenv("GISDBASE", gisdbase);
+    G__setenv("LOCATION_NAME", location);
     G__setenv("MAPSET", mapset);
     G__setenv("MAPSET", mapset);
     G__read_mapset_env();
     G__read_mapset_env();