[GRASS-SVN] r58310 - grass/trunk/vector/v.out.postgis

svn_grass at osgeo.org svn_grass at osgeo.org
Mon Nov 25 13:59:22 PST 2013


Author: martinl
Date: 2013-11-25 13:59:21 -0800 (Mon, 25 Nov 2013)
New Revision: 58310

Modified:
   grass/trunk/vector/v.out.postgis/create.c
Log:
v.out.postgis: replace setenv()/unsetenv() by portable putenv()


Modified: grass/trunk/vector/v.out.postgis/create.c
===================================================================
--- grass/trunk/vector/v.out.postgis/create.c	2013-11-25 21:23:08 UTC (rev 58309)
+++ grass/trunk/vector/v.out.postgis/create.c	2013-11-25 21:59:21 UTC (rev 58310)
@@ -13,6 +13,7 @@
 {
     int   i;
     char *filename, *conninfo;
+    char buf[GPATH_MAX];
     FILE *fp;
     
     struct Key_Value *key_val;
@@ -24,7 +25,8 @@
     fp = G_fopen_new("", filename);
     if (!fp)
         G_fatal_error(_("Unable to create <%s> file"), filename);
-    setenv("GRASS_VECTOR_PGFILE", filename, TRUE);
+    sprintf(buf, "GRASS_VECTOR_PGFILE=%s", filename);
+    putenv(G_store(buf));
     G_add_error_handler(file_handler, filename);
 
     key_val = G_create_key_value();
@@ -98,5 +100,5 @@
     
     G_debug(1, "file_handler: %s", filename);
     G_remove("", filename);
-    unsetenv("GRASS_VECTOR_PGFILE");
+    putenv("GRASS_VECTOR_PGFILE=");
 }



More information about the grass-commit mailing list