[GRASS-SVN] r63699 - grass/branches/releasebranch_7_0/vector/v.to.db

svn_grass at osgeo.org svn_grass at osgeo.org
Wed Dec 24 02:05:57 PST 2014


Author: martinl
Date: 2014-12-24 02:05:57 -0800 (Wed, 24 Dec 2014)
New Revision: 63699

Modified:
   grass/branches/releasebranch_7_0/vector/v.to.db/main.c
Log:
v.to.db: check if the map is in the current mapset (when modifying data)
         bugfix segfault
         (merge r63698 from trunk)


Modified: grass/branches/releasebranch_7_0/vector/v.to.db/main.c
===================================================================
--- grass/branches/releasebranch_7_0/vector/v.to.db/main.c	2014-12-24 09:40:34 UTC (rev 63698)
+++ grass/branches/releasebranch_7_0/vector/v.to.db/main.c	2014-12-24 10:05:57 UTC (rev 63699)
@@ -40,13 +40,24 @@
 
     parse_command_line(argc, argv);
 
+    if (!options.print && !options.total) {
+        const char *mapset;
+
+        mapset = G_find_vector2(options.name, "");
+        if (!mapset || (strcmp(mapset, G_mapset()) != 0))
+            G_fatal_error(_("Vector map <%s> not found in the current mapset. "
+                            "Unable to modify vector maps from different mapsets."),
+                          options.name);
+    }
+
     G_begin_distance_calculations();
     G_begin_polygon_area_calculations();
 
     /* open map */
     Vect_set_open_level(2);
     Vect_open_old(&Map, options.name, "");
-
+    Vect_set_error_handler_io(&Map, NULL);
+   
     Fi = Vect_get_field(&Map, options.field);
 
     if (!options.print && Fi == NULL) {



More information about the grass-commit mailing list