[GRASS-SVN] r63698 - grass/trunk/vector/v.to.db

svn_grass at osgeo.org svn_grass at osgeo.org
Wed Dec 24 01:40:34 PST 2014


Author: martinl
Date: 2014-12-24 01:40:34 -0800 (Wed, 24 Dec 2014)
New Revision: 63698

Modified:
   grass/trunk/vector/v.to.db/main.c
Log:
v.to.db: check if the map is in the current mapset (when modifying data)

Modified: grass/trunk/vector/v.to.db/main.c
===================================================================
--- grass/trunk/vector/v.to.db/main.c	2014-12-23 21:54:30 UTC (rev 63697)
+++ grass/trunk/vector/v.to.db/main.c	2014-12-24 09:40:34 UTC (rev 63698)
@@ -40,14 +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);
-    if (Vect_open_old(&Map, options.name, "") < 0)
-	G_fatal_error(_("Unable to open vector map <%s>"), options.name);
-
+    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