[GRASS-SVN] r53974 - grass/trunk/vector/v.out.postgis
svn_grass at osgeo.org
svn_grass at osgeo.org
Fri Nov 23 03:28:48 PST 2012
Author: martinl
Date: 2012-11-23 03:28:45 -0800 (Fri, 23 Nov 2012)
New Revision: 53974
Modified:
grass/trunk/vector/v.out.postgis/create.c
grass/trunk/vector/v.out.postgis/main.c
Log:
v.out.postgis: bugfix (create_pgfile)
add error handler for map link
Modified: grass/trunk/vector/v.out.postgis/create.c
===================================================================
--- grass/trunk/vector/v.out.postgis/create.c 2012-11-23 09:59:50 UTC (rev 53973)
+++ grass/trunk/vector/v.out.postgis/create.c 2012-11-23 11:28:45 UTC (rev 53974)
@@ -53,7 +53,7 @@
int length;
length = strlen(dsn);
- conninfo = (char *) G_malloc(length - 3);
+ conninfo = (char *) G_malloc(length - 2);
for (i = 3; i < length; i++)
conninfo[i-3] = dsn[i];
conninfo[length-3] = '\0';
Modified: grass/trunk/vector/v.out.postgis/main.c
===================================================================
--- grass/trunk/vector/v.out.postgis/main.c 2012-11-23 09:59:50 UTC (rev 53973)
+++ grass/trunk/vector/v.out.postgis/main.c 2012-11-23 11:28:45 UTC (rev 53974)
@@ -21,6 +21,8 @@
#include "local_proto.h"
+static void link_handler(void *);
+
int main(int argc, char *argv[])
{
struct GModule *module;
@@ -88,7 +90,10 @@
if (ret == -1)
G_fatal_error(_("Unable to open vector map <%s>"),
params.input->answer);
- Vect_set_error_handler_io(&In, &Out);
+ Vect_set_error_handler_io(&In, NULL);
+ if (params.olink->answer)
+ G_add_error_handler(link_handler, params.olink->answer);
+
if (ret < 2)
G_warning(_("Unable to open vector map <%s> on topological level"),
params.input->answer);
@@ -132,3 +137,11 @@
exit(EXIT_SUCCESS);
}
+
+void link_handler(void *p) {
+ const char *link = (const char *) p;
+
+ G_debug(1, "link_handler: %s", link);
+ if (G_find_vector2(link, G_mapset()))
+ Vect_delete(link);
+}
More information about the grass-commit
mailing list