[GRASS-SVN] r60054 - in grass/trunk: display/d.extract display/d.path display/d.vect.chart general/manage/lister lib/sites lib/vector/Vlib ps/ps.map raster/r.carve raster/r.contour raster/r.le/r.le.setup raster/r.random raster/r.stream.extract raster/r.stream.order raster/r.stream.segment raster/r.stream.snap raster/r.to.vect raster/r.volume raster/simwe/simlib vector/v.buffer vector/v.build vector/v.build.polylines vector/v.class vector/v.clean vector/v.clean/test vector/v.colors vector/v.colors.out vector/v.db.connect vector/v.db.select vector/v.delaunay vector/v.distance vector/v.drape vector/v.edit vector/v.external vector/v.extract vector/v.extrude vector/v.in.ascii vector/v.in.db vector/v.in.dwg vector/v.in.lidar vector/v.in.ogr vector/v.in.region vector/v.in.sites vector/v.kernel vector/v.label vector/v.label.sa vector/v.lrs/v.lrs.create vector/v.lrs/v.lrs.label vector/v.lrs/v.lrs.segment vector/v.lrs/v.lrs.where vector/v.neighbors vector/v.net.alloc vector/v.net.iso vect or/v.net.path vector/v.net.salesman vector/v.net.steiner vector/v.normal vector/v.out.dxf vector/v.out.ogr vector/v.out.pov vector/v.out.svg vector/v.overlay vector/v.parallel vector/v.patch vector/v.perturb vector/v.proj vector/v.qcount vector/v.reclass vector/v.rectify vector/v.sample vector/v.segment vector/v.select vector/v.split vector/v.surf.idw vector/v.surf.rst vector/v.to.db vector/v.to.points vector/v.to.rast vector/v.to.rast3 vector/v.transform vector/v.type vector/v.univar vector/v.vect.stats vector/v.vol.rst vector/v.voronoi vector/v.what.rast vector/v.what.rast3

svn_grass at osgeo.org svn_grass at osgeo.org
Sat May 3 06:49:33 PDT 2014


Author: hcho
Date: 2014-05-03 06:49:33 -0700 (Sat, 03 May 2014)
New Revision: 60054

Modified:
   grass/trunk/display/d.extract/main.c
   grass/trunk/display/d.path/main.c
   grass/trunk/display/d.vect.chart/main.c
   grass/trunk/general/manage/lister/vector.c
   grass/trunk/lib/sites/sites.c
   grass/trunk/lib/vector/Vlib/build.c
   grass/trunk/lib/vector/Vlib/map.c
   grass/trunk/lib/vector/Vlib/open.c
   grass/trunk/ps/ps.map/do_vectors.c
   grass/trunk/raster/r.carve/main.c
   grass/trunk/raster/r.carve/vect.c
   grass/trunk/raster/r.contour/main.c
   grass/trunk/raster/r.le/r.le.setup/sample.c
   grass/trunk/raster/r.random/random.c
   grass/trunk/raster/r.random/support.c
   grass/trunk/raster/r.stream.extract/close.c
   grass/trunk/raster/r.stream.order/stream_vector.c
   grass/trunk/raster/r.stream.segment/stream_vector.c
   grass/trunk/raster/r.stream.snap/points_io.c
   grass/trunk/raster/r.to.vect/main.c
   grass/trunk/raster/r.volume/main.c
   grass/trunk/raster/simwe/simlib/output.c
   grass/trunk/vector/v.buffer/main.c
   grass/trunk/vector/v.build.polylines/main.c
   grass/trunk/vector/v.build/main.c
   grass/trunk/vector/v.class/main.c
   grass/trunk/vector/v.clean/main.c
   grass/trunk/vector/v.clean/test/topocheck.c
   grass/trunk/vector/v.colors.out/make_colors.c
   grass/trunk/vector/v.colors.out/scan_cats.c
   grass/trunk/vector/v.colors/main.c
   grass/trunk/vector/v.db.connect/main.c
   grass/trunk/vector/v.db.select/main.c
   grass/trunk/vector/v.delaunay/main.c
   grass/trunk/vector/v.distance/main.c
   grass/trunk/vector/v.drape/main.c
   grass/trunk/vector/v.edit/main.c
   grass/trunk/vector/v.external/main.c
   grass/trunk/vector/v.extract/main.c
   grass/trunk/vector/v.extrude/main.c
   grass/trunk/vector/v.in.ascii/main.c
   grass/trunk/vector/v.in.db/main.c
   grass/trunk/vector/v.in.dwg/main.c
   grass/trunk/vector/v.in.lidar/main.c
   grass/trunk/vector/v.in.ogr/main.c
   grass/trunk/vector/v.in.region/main.c
   grass/trunk/vector/v.in.sites/main.c
   grass/trunk/vector/v.kernel/main.c
   grass/trunk/vector/v.label.sa/labels.c
   grass/trunk/vector/v.label/main.c
   grass/trunk/vector/v.lrs/v.lrs.create/main.c
   grass/trunk/vector/v.lrs/v.lrs.label/main.c
   grass/trunk/vector/v.lrs/v.lrs.segment/main.c
   grass/trunk/vector/v.lrs/v.lrs.where/main.c
   grass/trunk/vector/v.neighbors/main.c
   grass/trunk/vector/v.net.alloc/main.c
   grass/trunk/vector/v.net.iso/main.c
   grass/trunk/vector/v.net.path/main.c
   grass/trunk/vector/v.net.salesman/main.c
   grass/trunk/vector/v.net.steiner/main.c
   grass/trunk/vector/v.normal/main.c
   grass/trunk/vector/v.out.dxf/main.c
   grass/trunk/vector/v.out.ogr/main.c
   grass/trunk/vector/v.out.pov/main.c
   grass/trunk/vector/v.out.svg/main.c
   grass/trunk/vector/v.overlay/main.c
   grass/trunk/vector/v.parallel/main.c
   grass/trunk/vector/v.patch/main.c
   grass/trunk/vector/v.perturb/main.c
   grass/trunk/vector/v.proj/main.c
   grass/trunk/vector/v.qcount/main.c
   grass/trunk/vector/v.reclass/main.c
   grass/trunk/vector/v.rectify/main.c
   grass/trunk/vector/v.sample/main.c
   grass/trunk/vector/v.segment/main.c
   grass/trunk/vector/v.select/main.c
   grass/trunk/vector/v.split/main.c
   grass/trunk/vector/v.surf.idw/read_sites.c
   grass/trunk/vector/v.surf.rst/main.c
   grass/trunk/vector/v.to.db/main.c
   grass/trunk/vector/v.to.points/main.c
   grass/trunk/vector/v.to.rast/support.c
   grass/trunk/vector/v.to.rast/vect2rast.c
   grass/trunk/vector/v.to.rast3/main.c
   grass/trunk/vector/v.transform/main.c
   grass/trunk/vector/v.type/main.c
   grass/trunk/vector/v.univar/main.c
   grass/trunk/vector/v.vect.stats/main.c
   grass/trunk/vector/v.vol.rst/main.c
   grass/trunk/vector/v.voronoi/main.c
   grass/trunk/vector/v.what.rast/main.c
   grass/trunk/vector/v.what.rast3/main.c
Log:
Added missing checks for Vect_open_* return value to avoid potential segmentation fault

Modified: grass/trunk/display/d.extract/main.c
===================================================================
--- grass/trunk/display/d.extract/main.c	2014-05-03 02:48:38 UTC (rev 60053)
+++ grass/trunk/display/d.extract/main.c	2014-05-03 13:49:33 UTC (rev 60054)
@@ -98,8 +98,13 @@
 	G_fatal_error(_("Vector map <%s> not found"), input->answer);
 
     Vect_set_open_level(2);
-    Vect_open_old(&In, input->answer, mapset);
-    Vect_open_new(&Out, output->answer, Vect_is_3d(&In));
+
+    if (Vect_open_old(&In, input->answer, mapset) < 0)
+	G_fatal_error(_("Unable to open vector map <%s>"), input->answer);
+
+    if (Vect_open_new(&Out, output->answer, Vect_is_3d(&In)) < 0)
+	G_fatal_error(_("Unable to create vector map <%s>"), output->answer);
+
     Vect_copy_head_data(&In, &Out);
     Vect_hist_copy(&In, &Out);
     Vect_hist_command(&Out);

Modified: grass/trunk/display/d.path/main.c
===================================================================
--- grass/trunk/display/d.path/main.c	2014-05-03 02:48:38 UTC (rev 60053)
+++ grass/trunk/display/d.path/main.c	2014-05-03 13:49:33 UTC (rev 60054)
@@ -184,7 +184,8 @@
 	geo = 0;
 
     Vect_set_open_level(2);
-    Vect_open_old(&Map, map->answer, "");
+    if (Vect_open_old(&Map, map->answer, "") < 0)
+	G_fatal_error(_("Unable to open vector map <%s>"), map->answer);
 
     D_setup(0);
 

Modified: grass/trunk/display/d.vect.chart/main.c
===================================================================
--- grass/trunk/display/d.vect.chart/main.c	2014-05-03 02:48:38 UTC (rev 60053)
+++ grass/trunk/display/d.vect.chart/main.c	2014-05-03 13:49:33 UTC (rev 60054)
@@ -243,7 +243,8 @@
 
     /* open vector */
     Vect_set_open_level(2);
-    Vect_open_old(&Map, map_opt->answer, "");
+    if (Vect_open_old(&Map, map_opt->answer, "") < 0)
+	G_fatal_error(_("Unable to open vector map <%s>"), map_opt->answer);
 
     ctype = CTYPE_PIE;
     if (ctype_opt->answer[0] == 'b')

Modified: grass/trunk/general/manage/lister/vector.c
===================================================================
--- grass/trunk/general/manage/lister/vector.c	2014-05-03 02:48:38 UTC (rev 60053)
+++ grass/trunk/general/manage/lister/vector.c	2014-05-03 13:49:33 UTC (rev 60054)
@@ -2,6 +2,7 @@
 #include <string.h>
 #include <grass/gis.h>
 #include <grass/vector.h>
+#include <grass/glocale.h>
 
 int main(int argc, char *argv[])
 {
@@ -19,7 +20,8 @@
 
     *title = 0;
     if (*name) {
-	Vect_open_old_head(&Map, name, mapset);
+	if (Vect_open_old_head(&Map, name, mapset) < 0)
+	    G_fatal_error(_("Unable to open vector map <%s>"), name);
 	strcpy(title, Vect_get_map_name(&Map));
 	Vect_close(&Map);
     }

Modified: grass/trunk/lib/sites/sites.c
===================================================================
--- grass/trunk/lib/sites/sites.c	2014-05-03 02:48:38 UTC (rev 60053)
+++ grass/trunk/lib/sites/sites.c	2014-05-03 13:49:33 UTC (rev 60054)
@@ -258,8 +258,10 @@
     Map = (struct Map_info *)G_malloc(sizeof(struct Map_info));
 
     Vect_set_open_level(1);
-    Vect_open_old(Map, name, mapset);
 
+    if (Vect_open_old(Map, name, mapset) < 0)
+	G_fatal_error(_("Unable to open vector map <%s>"), name);
+
     G_debug(1, "Vector map opened");
 
     /* Load attributes */
@@ -388,7 +390,8 @@
 
     Map = (struct Map_info *)G_malloc(sizeof(struct Map_info));
 
-    Vect_open_new(Map, name, 0);
+    if (Vect_open_new(Map, name, 0) < 0)
+	G_fatal_error(_("Unable to create vector map <%s>"), name);
 
     G_debug(1, "New vector map opened");
 

Modified: grass/trunk/lib/vector/Vlib/build.c
===================================================================
--- grass/trunk/lib/vector/Vlib/build.c	2014-05-03 02:48:38 UTC (rev 60053)
+++ grass/trunk/lib/vector/Vlib/build.c	2014-05-03 13:49:33 UTC (rev 60054)
@@ -838,8 +838,11 @@
         /* don't write support files for OGR direct and PostGIS Topology */
 	Map->support_updated = TRUE;
 
-    if (!Map->plus.Spidx_built)
-	Vect_open_sidx(Map, 2);
+    if (!Map->plus.Spidx_built) {
+	if (Vect_open_sidx(Map, 2) < 0)
+	    G_fatal_error(_("Unable to open spatial index file for vector map <%s>"),
+			    Vect_get_full_name(Map));
+    }
 
     plus = &(Map->plus);
     if (build > GV_BUILD_NONE && !Map->temporary) {

Modified: grass/trunk/lib/vector/Vlib/map.c
===================================================================
--- grass/trunk/lib/vector/Vlib/map.c	2014-05-03 02:48:38 UTC (rev 60053)
+++ grass/trunk/lib/vector/Vlib/map.c	2014-05-03 13:49:33 UTC (rev 60054)
@@ -155,7 +155,8 @@
 
     /* Open input */
     Vect_set_open_level(1);
-    Vect_open_old_head(&In, in, mapset);
+    if (Vect_open_old_head(&In, in, mapset) < 0)
+	G_fatal_error(_("Unable to open vector map <%s>"), in);
 
     if (In.format != GV_FORMAT_NATIVE) {        /* Done */
         Vect_close(&In);
@@ -164,7 +165,8 @@
 
     /* Open output */
     Vect_set_open_level(1);
-    Vect_open_update_head(&Out, out, G_mapset());
+    if (Vect_open_update_head(&Out, out, G_mapset()) < 0)
+	G_fatal_error(_("Unable to open vector map <%s>"), out);
 
     /* Copy tables */
     n = Vect_get_num_dblinks(&In);
@@ -276,7 +278,8 @@
 
     /* Rename all tables if the format is native */
     Vect_set_open_level(1);
-    Vect_open_update_head(&Map, out, G_mapset());
+    if (Vect_open_update_head(&Map, out, G_mapset()) < 0)
+	G_fatal_error(_("Unable to open vector map <%s>"), out);
 
     if (Map.format != GV_FORMAT_NATIVE) {       /* Done */
         Vect_close(&Map);

Modified: grass/trunk/lib/vector/Vlib/open.c
===================================================================
--- grass/trunk/lib/vector/Vlib/open.c	2014-05-03 02:48:38 UTC (rev 60053)
+++ grass/trunk/lib/vector/Vlib/open.c	2014-05-03 13:49:33 UTC (rev 60054)
@@ -859,7 +859,9 @@
     dig_init_plus(&(Map->plus));
 
     /* open new spatial index */
-    Vect_open_sidx(Map, 2);
+    if (Vect_open_sidx(Map, 2) < 0)
+	G_fatal_error(_("Unable to open spatial index file for vector map <%s>"),
+			Vect_get_full_name(Map));
 
     Map->open = VECT_OPEN_CODE;
     Map->head_only = FALSE;
@@ -1164,6 +1166,7 @@
   \param[in,out] Map pointer to Map_info
   \param mode 0 old, 1 update, 2 new
   
+  \return 1 if sidx file is not available
   \return 0 on success
   \return -1 on error
 */

Modified: grass/trunk/ps/ps.map/do_vectors.c
===================================================================
--- grass/trunk/ps/ps.map/do_vectors.c	2014-05-03 02:48:38 UTC (rev 60053)
+++ grass/trunk/ps/ps.map/do_vectors.c	2014-05-03 13:49:33 UTC (rev 60054)
@@ -34,9 +34,8 @@
 		  vector.layer[n].name, vector.layer[n].mapset);
 
 	Vect_set_open_level(2);
-	if (2 >
-	    Vect_open_old(&Map, vector.layer[n].name,
-			  vector.layer[n].mapset)) {
+	if (2 > Vect_open_old(&Map, vector.layer[n].name,
+				vector.layer[n].mapset)) {
 	    char name[100];
 
 	    sprintf(name, "%s in %s", vector.layer[n].name,
@@ -138,9 +137,8 @@
 		  vector.layer[n].name, vector.layer[n].mapset);
 
 	Vect_set_open_level(2);
-	if (2 >
-	    Vect_open_old(&Map, vector.layer[n].name,
-			  vector.layer[n].mapset)) {
+	if (2 > Vect_open_old(&Map, vector.layer[n].name,
+				vector.layer[n].mapset)) {
 	    char name[100];
 
 	    sprintf(name, "%s in %s", vector.layer[n].name,

Modified: grass/trunk/raster/r.carve/main.c
===================================================================
--- grass/trunk/raster/r.carve/main.c	2014-05-03 02:48:38 UTC (rev 60053)
+++ grass/trunk/raster/r.carve/main.c	2014-05-03 13:49:33 UTC (rev 60054)
@@ -158,7 +158,8 @@
 	G_fatal_error(_("Vector map <%s> not found"), parm.invect->answer);
 
     Vect_set_open_level(2);
-    Vect_open_old(&Map, parm.invect->answer, vmapset);
+    if (Vect_open_old(&Map, parm.invect->answer, vmapset) < 0)
+	G_fatal_error(_("Unable to open vector map <%s>"), parm.invect->answer);
 
     if ((rmapset = G_find_file2("cell", parm.inrast->answer, "")) == NULL)
 	G_fatal_error(_("Raster map <%s> not found"), parm.inrast->answer);

Modified: grass/trunk/raster/r.carve/vect.c
===================================================================
--- grass/trunk/raster/r.carve/vect.c	2014-05-03 02:48:38 UTC (rev 60053)
+++ grass/trunk/raster/r.carve/vect.c	2014-05-03 13:49:33 UTC (rev 60054)
@@ -19,6 +19,7 @@
 
 #include <stdio.h>
 #include <grass/gis.h>
+#include <grass/glocale.h>
 #include "enforce.h"
 
 
@@ -27,7 +28,9 @@
  */
 int open_new_vect(struct Map_info *map, char *vect)
 {
-    Vect_open_new(map, vect, 1);
+    if (Vect_open_new(map, vect, 1) < 0)
+	G_fatal_error(_("Unable to create vector map <%s>"), vect);
+
     Vect_set_map_name(map, vect);
     Vect_set_comment(map, G_recreate_command());
     Vect_hist_command(map);

Modified: grass/trunk/raster/r.contour/main.c
===================================================================
--- grass/trunk/raster/r.contour/main.c	2014-05-03 02:48:38 UTC (rev 60053)
+++ grass/trunk/raster/r.contour/main.c	2014-05-03 13:49:33 UTC (rev 60054)
@@ -149,7 +149,9 @@
     /* get window info */
     G_get_window(&Wind);
 
-    Vect_open_new(&Map, vect->answer, 1);
+    if (Vect_open_new(&Map, vect->answer, 1) < 0)
+	G_fatal_error(_("Unable to create vector map <%s>"), vect->answer);
+
     Vect_hist_command(&Map);
 
     db_init_string(&sql);

Modified: grass/trunk/raster/r.le/r.le.setup/sample.c
===================================================================
--- grass/trunk/raster/r.le/r.le.setup/sample.c	2014-05-03 02:48:38 UTC (rev 60053)
+++ grass/trunk/raster/r.le/r.le.setup/sample.c	2014-05-03 13:49:33 UTC (rev 60054)
@@ -1033,7 +1033,8 @@
 	    exit(0);
 	}
 
-	Vect_open_old(&Map, sites_file_name, sites_mapset);
+	if (Vect_open_old(&Map, sites_file_name, sites_mapset) < 0)
+	    G_fatal_error(_("Unable to open vector map <%s>"), sites_file_name);
 	/*    fprintf(stderr, "\n    Can't open vector points file %s\n", sites_file_name); */
 
 	*sites = 0;

Modified: grass/trunk/raster/r.random/random.c
===================================================================
--- grass/trunk/raster/r.random/random.c	2014-05-03 02:48:38 UTC (rev 60053)
+++ grass/trunk/raster/r.random/random.c	2014-05-03 13:49:33 UTC (rev 60054)
@@ -59,10 +59,9 @@
     }
 
     if (theState->outvector) {
-	if (theState->z_geometry)
-	    Vect_open_new(&Out, theState->outvector, 1);
-	else
-	    Vect_open_new(&Out, theState->outvector, 0);
+	if (Vect_open_new(&Out, theState->outvector, theState->z_geometry) < 0)
+	    G_fatal_error(_("Unable to create vector map <%s>"),
+			    theState->outvector);
 	Vect_hist_command(&Out);
 
 	fi = Vect_default_field_info(&Out, 1, NULL, GV_1TABLE);

Modified: grass/trunk/raster/r.random/support.c
===================================================================
--- grass/trunk/raster/r.random/support.c	2014-05-03 02:48:38 UTC (rev 60053)
+++ grass/trunk/raster/r.random/support.c	2014-05-03 13:49:33 UTC (rev 60054)
@@ -1,6 +1,7 @@
 #include <grass/gis.h>
 #include <grass/raster.h>
 #include <grass/vector.h>
+#include <grass/glocale.h>
 #include "local_proto.h"
 
 
@@ -58,7 +59,9 @@
     if (theState->outvector) {
 	struct Map_info map;
 
-	Vect_open_old(&map, theState->outvector, G_mapset());
+	if (Vect_open_old(&map, theState->outvector, G_mapset()) < 0)
+	    G_fatal_error(_("Unable to open vector map <%s>"),
+			    theState->outvector);
 	Vect_hist_command(&map);
 	Vect_close(&map);
     }

Modified: grass/trunk/raster/r.stream.extract/close.c
===================================================================
--- grass/trunk/raster/r.stream.extract/close.c	2014-05-03 02:48:38 UTC (rev 60053)
+++ grass/trunk/raster/r.stream.extract/close.c	2014-05-03 13:49:33 UTC (rev 60054)
@@ -33,7 +33,8 @@
 
     G_message(_("Writing vector map <%s>..."), stream_vect);
 
-    Vect_open_new(&Out, stream_vect, 0);
+    if (Vect_open_new(&Out, stream_vect, 0) < 0)
+	G_fatal_error(_("Unable to create vector map <%s>"), stream_vect);
     
     nodestack = (struct sstack *)G_malloc(stack_step * sizeof(struct sstack));
 

Modified: grass/trunk/raster/r.stream.order/stream_vector.c
===================================================================
--- grass/trunk/raster/r.stream.order/stream_vector.c	2014-05-03 02:48:38 UTC (rev 60053)
+++ grass/trunk/raster/r.stream.order/stream_vector.c	2014-05-03 13:49:33 UTC (rev 60054)
@@ -17,8 +17,10 @@
     G_get_window(&window);
     Segments = Vect_new_line_struct();
     Cats = Vect_new_cats_struct();
-    Vect_open_new(&Out, out_vector, 0);
 
+    if (Vect_open_new(&Out, out_vector, 0) < 0)
+	G_fatal_error(_("Unable to create vector map <%s>"), out_vector);
+
     Vect_reset_line(Segments);
     Vect_reset_cats(Cats);
 
@@ -102,7 +104,9 @@
     G_get_window(&window);
     Segments = Vect_new_line_struct();
     Cats = Vect_new_cats_struct();
-    Vect_open_new(&Out, out_vector, 0);
+    
+    if (Vect_open_new(&Out, out_vector, 0) < 0)
+	G_fatal_error(_("Unable to create vector map <%s>"), out_vector);
 
     Vect_reset_line(Segments);
     Vect_reset_cats(Cats);

Modified: grass/trunk/raster/r.stream.segment/stream_vector.c
===================================================================
--- grass/trunk/raster/r.stream.segment/stream_vector.c	2014-05-03 02:48:38 UTC (rev 60053)
+++ grass/trunk/raster/r.stream.segment/stream_vector.c	2014-05-03 13:49:33 UTC (rev 60054)
@@ -24,7 +24,9 @@
 
     Segments = Vect_new_line_struct();
     Cats = Vect_new_cats_struct();
-    Vect_open_new(&Out, out_vector, 0);
+    
+    if (Vect_open_new(&Out, out_vector, 0) < 0)
+	G_fatal_error(_("Unable to create vector map <%s>"), out_vector);
 
     Vect_reset_line(Segments);
     Vect_reset_cats(Cats);
@@ -183,7 +185,9 @@
 
     Segments = Vect_new_line_struct();
     Cats = Vect_new_cats_struct();
-    Vect_open_new(&Out, out_vector, 0);
+    
+    if (Vect_open_new(&Out, out_vector, 0) < 0)
+	G_fatal_error(_("Unable to create vector map <%s>"), out_vector);
 
     Vect_reset_line(Segments);
     Vect_reset_cats(Cats);

Modified: grass/trunk/raster/r.stream.snap/points_io.c
===================================================================
--- grass/trunk/raster/r.stream.snap/points_io.c	2014-05-03 02:48:38 UTC (rev 60053)
+++ grass/trunk/raster/r.stream.snap/points_io.c	2014-05-03 13:49:33 UTC (rev 60054)
@@ -15,7 +15,8 @@
     sites = Vect_new_line_struct();
     cats = Vect_new_cats_struct();
 
-    Vect_open_old(&Map, in_point, "");
+    if (Vect_open_old(&Map, in_point, "") < 0)
+	G_fatal_error(_("Unable to open vector map <%s>"), in_point);
     
     G_get_window(&window);
     Vect_region_box(&window, &box);
@@ -82,7 +83,9 @@
     G_get_window(&window);
     Segments = Vect_new_line_struct();
     Cats = Vect_new_cats_struct();
-    Vect_open_new(&Out, out_vector, 0);
+    
+    if (Vect_open_new(&Out, out_vector, 0) < 0)
+	G_fatal_error(_("Unable to create vector map <%s>"), out_vector);
 
     Vect_reset_line(Segments);
     Vect_reset_cats(Cats);

Modified: grass/trunk/raster/r.to.vect/main.c
===================================================================
--- grass/trunk/raster/r.to.vect/main.c	2014-05-03 02:48:38 UTC (rev 60053)
+++ grass/trunk/raster/r.to.vect/main.c	2014-05-03 13:49:33 UTC (rev 60054)
@@ -144,10 +144,8 @@
 	G_warning(_("Categories will be unique sequence, raster values will be lost."));
     }
 
-    if (z_flg->answer)
-	Vect_open_new(&Map, out_opt->answer, 1);
-    else
-	Vect_open_new(&Map, out_opt->answer, 0);
+    if (Vect_open_new(&Map, out_opt->answer, z_flg->answer) < 0)
+	G_fatal_error(_("Unable to create vector map <%s>"), out_opt->answer);
 
     Vect_hist_command(&Map);
 

Modified: grass/trunk/raster/r.volume/main.c
===================================================================
--- grass/trunk/raster/r.volume/main.c	2014-05-03 02:48:38 UTC (rev 60053)
+++ grass/trunk/raster/r.volume/main.c	2014-05-03 13:49:33 UTC (rev 60054)
@@ -150,7 +150,8 @@
     
     /* initialize vector map (for centroids) if needed */
     if (centroidsmap) {
-	Vect_open_new(fd_centroids, centroidsmap, WITHOUT_Z);
+	if (Vect_open_new(fd_centroids, centroidsmap, WITHOUT_Z) < 0)
+	    G_fatal_error(_("Unable to create vector map <%s>"), centroidsmap);
         
         Points = Vect_new_line_struct();
         Cats = Vect_new_cats_struct();

Modified: grass/trunk/raster/simwe/simlib/output.c
===================================================================
--- grass/trunk/raster/simwe/simlib/output.c	2014-05-03 02:48:38 UTC (rev 60053)
+++ grass/trunk/raster/simwe/simlib/output.c	2014-05-03 13:49:33 UTC (rev 60054)
@@ -34,11 +34,14 @@
 	if (ts == 1) {
 	    G_snprintf(buf, sizeof(buf), "%s_%.*d", outwalk, ndigit, tt_minutes);
 	    outwalk_time = G_store(buf);
-	    Vect_open_new(&Out, outwalk_time, WITH_Z);
+	    if (Vect_open_new(&Out, outwalk_time, WITH_Z) < 0)
+		G_fatal_error(_("Unable to create vector map <%s>"),
+				outwalk_time);
 	    G_message("Writing %i walker into vector file %s", nstack, outwalk_time);
 	}
 	else {
-	    Vect_open_new(&Out, outwalk, WITH_Z);
+	    if (Vect_open_new(&Out, outwalk, WITH_Z) < 0)
+		G_fatal_error(_("Unable to create vector map <%s>"), outwalk);
 	    G_message("Writing %i walker into vector file %s", nstack, outwalk);
 	}
 

Modified: grass/trunk/vector/v.buffer/main.c
===================================================================
--- grass/trunk/vector/v.buffer/main.c	2014-05-03 02:48:38 UTC (rev 60053)
+++ grass/trunk/vector/v.buffer/main.c	2014-05-03 13:49:33 UTC (rev 60054)
@@ -326,7 +326,10 @@
     Vect_check_input_output_name(in_opt->answer, out_opt->answer, G_FATAL_EXIT);
 
     Vect_set_open_level(2); /* topology required */
-    Vect_open_old2(&In, in_opt->answer, "", field_opt->answer);
+
+    if (Vect_open_old2(&In, in_opt->answer, "", field_opt->answer) < 0)
+	G_fatal_error(_("Unable to open vector map <%s>"), in_opt->answer);
+
     Vect_set_error_handler_io(&In, &Out);
 
     if (field_opt->answer)
@@ -377,7 +380,8 @@
 	G_verbose_message(_("The tolerance in map units = %g"), unit_tolerance);
     }
 
-    Vect_open_new(&Out, out_opt->answer, WITHOUT_Z);
+    if (Vect_open_new(&Out, out_opt->answer, WITHOUT_Z) < 0)
+	G_fatal_error(_("Unable to create vector map <%s>"), out_opt->answer);
     
     Points = Vect_new_line_struct();
     Cats = Vect_new_cats_struct();
@@ -385,9 +389,9 @@
     CCats = Vect_new_cats_struct();
     
     /* open tmp vector for buffers, needed for cleaning */
-    if (0 > Vect_open_tmp_new(&Buf, NULL, WITHOUT_Z)) {
-        G_fatal_error(_("Unable to create vector map"));
-    }
+    if (0 > Vect_open_tmp_new(&Buf, NULL, WITHOUT_Z))
+        G_fatal_error(_("Unable to create temporary vector map"));
+
     G_set_verbose(0);
     Vect_build_partial(&Buf, GV_BUILD_BASE); /* switch to level 2 */
     G_set_verbose(verbose);

Modified: grass/trunk/vector/v.build/main.c
===================================================================
--- grass/trunk/vector/v.build/main.c	2014-05-03 02:48:38 UTC (rev 60053)
+++ grass/trunk/vector/v.build/main.c	2014-05-03 13:49:33 UTC (rev 60054)
@@ -113,7 +113,9 @@
 	    }
 	}
 	Vect_set_open_level(1);
-	Vect_open_old(&Map, map_opt->answer, G_mapset());
+
+	if (Vect_open_old(&Map, map_opt->answer, G_mapset()) < 0)
+	    G_fatal_error(_("Unable to open vector map <%s>"), map_opt->answer);
         
 	Vect_build(&Map);
     }
@@ -121,7 +123,10 @@
     if (dump || sdump || cdump || fdump) {
 	if (!build) {
 	    Vect_set_open_level(2);
-	    Vect_open_old(&Map, map_opt->answer, "");
+
+	    if (Vect_open_old(&Map, map_opt->answer, "") < 0)
+		G_fatal_error(_("Unable to open vector map <%s>"),
+				map_opt->answer);
 	}
 	if (dump)
 	    Vect_topo_dump(&Map, stdout);
@@ -145,7 +150,9 @@
 	Points = Vect_new_line_struct();
 	Cats = Vect_new_cats_struct();
 
-	Vect_open_new(&Err, err_opt->answer, Vect_is_3d(&Map));
+	if (Vect_open_new(&Err, err_opt->answer, Vect_is_3d(&Map)) < 0)
+	    G_fatal_error(_("Unable to create vector map <%s>"),
+			    err_opt->answer);
 
 	nlines = Vect_get_num_lines(&Map);
 

Modified: grass/trunk/vector/v.build.polylines/main.c
===================================================================
--- grass/trunk/vector/v.build.polylines/main.c	2014-05-03 02:48:38 UTC (rev 60053)
+++ grass/trunk/vector/v.build.polylines/main.c	2014-05-03 13:49:33 UTC (rev 60054)
@@ -145,11 +145,13 @@
 
     /* Open binary vector map at level 2 */
     Vect_set_open_level(2);
-    Vect_open_old(&map, input->answer, "");
+    if (Vect_open_old(&map, input->answer, "") < 0)
+	G_fatal_error(_("Unable to open vector map <%s>"), input->answer);
 
     /* Open new vector */
     G_find_vector2(output->answer, "");
-    Vect_open_new(&Out, output->answer, Vect_is_3d(&map));
+    if (Vect_open_new(&Out, output->answer, Vect_is_3d(&map)) < 0)
+	G_fatal_error(_("Unable to create vector map <%s>"), output->answer);
 
     /* Copy header info. */
     Vect_copy_head_data(&map, &Out);

Modified: grass/trunk/vector/v.class/main.c
===================================================================
--- grass/trunk/vector/v.class/main.c	2014-05-03 02:48:38 UTC (rev 60053)
+++ grass/trunk/vector/v.class/main.c	2014-05-03 13:49:33 UTC (rev 60054)
@@ -98,7 +98,8 @@
     
     /* open input vector */
     Vect_set_open_level(2);
-    Vect_open_old2(&Map, map_opt->answer, "", field_opt->answer);
+    if (Vect_open_old2(&Map, map_opt->answer, "", field_opt->answer) < 0)
+	G_fatal_error(_("Unable to open vector map <%s>"), map_opt->answer);
 
     ofield = Vect_get_field_number(&Map, field_opt->answer);
 

Modified: grass/trunk/vector/v.clean/main.c
===================================================================
--- grass/trunk/vector/v.clean/main.c	2014-05-03 02:48:38 UTC (rev 60053)
+++ grass/trunk/vector/v.clean/main.c	2014-05-03 13:49:33 UTC (rev 60054)
@@ -274,16 +274,21 @@
      * virtual centroids (shapefile/OGR) and level 1 is better if input is too big 
      * and build in previous module (like v.in.ogr or other call to v.clean) would take 
      * a long time */
-    Vect_open_old2(&In, opt.in->answer, "", opt.field->answer);
+    if (Vect_open_old2(&In, opt.in->answer, "", opt.field->answer) < 0)
+	G_fatal_error(_("Unable to open vector map <%s>"), opt.in->answer);
 
     with_z = Vect_is_3d(&In);
     
-    Vect_open_new(&Out, opt.out->answer, with_z);
+    if (Vect_open_new(&Out, opt.out->answer, with_z) < 0)
+	G_fatal_error(_("Unable to create vector map <%s>"), opt.out->answer);
+
     Vect_set_error_handler_io(&In, &Out);
 
     if (opt.err->answer) {
 	Vect_set_open_level(2);
-	Vect_open_new(&Err, opt.err->answer, with_z);
+	if (Vect_open_new(&Err, opt.err->answer, with_z) < 0)
+	    G_fatal_error(_("Unable to create vector map <%s>"),
+			    opt.err->answer);
         G_add_error_handler(error_handler_err, &Err);
 	pErr = &Err;
     }

Modified: grass/trunk/vector/v.clean/test/topocheck.c
===================================================================
--- grass/trunk/vector/v.clean/test/topocheck.c	2014-05-03 02:48:38 UTC (rev 60053)
+++ grass/trunk/vector/v.clean/test/topocheck.c	2014-05-03 13:49:33 UTC (rev 60054)
@@ -63,7 +63,8 @@
 	G_fatal_error(_("Vector map <%s> not found"), in_opt->answer);
 
     Vect_set_open_level(2);
-    Vect_open_old(&In, in_opt->answer, mapset);
+    if (Vect_open_old(&In, in_opt->answer, mapset) < 0)
+	G_fatal_error(_("Unable to open vector map <%s>"), in_opt->answer);
 
     with_z = Vect_is_3d(&In);
 
@@ -82,7 +83,8 @@
 	Vect_close(&In);
 	Vect_close(&Out);
 
-	Vect_open_update(&Out, out_opt->answer, G_mapset());
+	if (Vect_open_update(&Out, out_opt->answer, G_mapset()) < 0)
+	    G_fatal_error(_("Unable to open vector map <%s>"), out_opt->answer);
 
 	/* Count number of areas and total area in input */
 	nareas1 = Vect_get_num_areas(&Out);

Modified: grass/trunk/vector/v.colors/main.c
===================================================================
--- grass/trunk/vector/v.colors/main.c	2014-05-03 02:48:38 UTC (rev 60053)
+++ grass/trunk/vector/v.colors/main.c	2014-05-03 13:49:33 UTC (rev 60054)
@@ -260,7 +260,9 @@
 
     /* open map and get min/max values */
     Vect_set_open_level(1); /* no topology required */
-    Vect_open_old2(&Map, name, mapset, opt.field->answer);
+    if (Vect_open_old2(&Map, name, mapset, opt.field->answer) < 0)
+	G_fatal_error(_("Unable to open vector map <%s>"), name);
+
     Vect_set_error_handler_io(&Map, NULL);
     if (use == USE_Z && !Vect_is_3d(&Map))
         G_fatal_error(_("Vector map <%s> is not 3D"), Vect_get_full_name(&Map));

Modified: grass/trunk/vector/v.colors.out/make_colors.c
===================================================================
--- grass/trunk/vector/v.colors.out/make_colors.c	2014-05-03 02:48:38 UTC (rev 60053)
+++ grass/trunk/vector/v.colors.out/make_colors.c	2014-05-03 13:49:33 UTC (rev 60054)
@@ -19,7 +19,8 @@
     dbCatVal *cv;
     
     Vect_set_open_level(1); /* no topology required */
-    Vect_open_old2(&Map, name, "", layer);
+    if (Vect_open_old2(&Map, name, "", layer) < 0)
+	G_fatal_error(_("Unable to open vector map <%s>"), name);
 
     field = Vect_get_field_number(&Map, layer);
     if (field < 1)

Modified: grass/trunk/vector/v.colors.out/scan_cats.c
===================================================================
--- grass/trunk/vector/v.colors.out/scan_cats.c	2014-05-03 02:48:38 UTC (rev 60053)
+++ grass/trunk/vector/v.colors.out/scan_cats.c	2014-05-03 13:49:33 UTC (rev 60054)
@@ -16,7 +16,9 @@
     *cmin = *cmax = -1;
 
     Vect_set_open_level(1); /* no topology required */
-    Vect_open_old2(&Map, name, "", layer);
+    if (Vect_open_old2(&Map, name, "", layer) < 0)
+	G_fatal_error(_("Unable to open vector map <%s>"), name);
+
     ilayer = Vect_get_field_number(&Map, layer);
     if (ilayer < 1)
 	G_fatal_error(_("Layer <%s> not found"), layer);

Modified: grass/trunk/vector/v.db.connect/main.c
===================================================================
--- grass/trunk/vector/v.db.connect/main.c	2014-05-03 02:48:38 UTC (rev 60053)
+++ grass/trunk/vector/v.db.connect/main.c	2014-05-03 13:49:33 UTC (rev 60054)
@@ -147,7 +147,8 @@
 
     Vect_set_open_level(1); /* no topology needed */
     if (print->answer || shell_print->answer || columns->answer) {
-	Vect_open_old2(&Map, inopt->answer, "", field_opt->answer);
+	if (Vect_open_old2(&Map, inopt->answer, "", field_opt->answer) < 0)
+	    G_fatal_error(_("Unable to open vector map <%s>"), inopt->answer);
     }
     else {
 	if (Vect_open_update_head(&Map, inopt->answer, G_mapset()) < 1)

Modified: grass/trunk/vector/v.db.select/main.c
===================================================================
--- grass/trunk/vector/v.db.select/main.c	2014-05-03 02:48:38 UTC (rev 60053)
+++ grass/trunk/vector/v.db.select/main.c	2014-05-03 13:49:33 UTC (rev 60054)
@@ -138,9 +138,10 @@
     db_init_string(&value_string);
 
     /* open input vector */
-    if (!r_flag->answer)
-	Vect_open_old_head2(&Map, map_opt->answer, "", field_opt->answer);
-    else {
+    if (!r_flag->answer) {
+	if (Vect_open_old_head2(&Map, map_opt->answer, "", field_opt->answer) < 0)
+	    G_fatal_error(_("Unable to open vector map <%s>"), map_opt->answer);
+    } else {
 	if (2 > Vect_open_old2(&Map, map_opt->answer, "", field_opt->answer)) {
 	    Vect_close(&Map);
 	    G_fatal_error(_("Unable to open vector map <%s> at topology level. "

Modified: grass/trunk/vector/v.delaunay/main.c
===================================================================
--- grass/trunk/vector/v.delaunay/main.c	2014-05-03 02:48:38 UTC (rev 60053)
+++ grass/trunk/vector/v.delaunay/main.c	2014-05-03 13:49:33 UTC (rev 60054)
@@ -116,7 +116,8 @@
     Cats = Vect_new_cats_struct();
     
     Vect_set_open_level(2);
-    Vect_open_old2(&In, in_opt->answer, "", field_opt->answer);
+    if (Vect_open_old2(&In, in_opt->answer, "", field_opt->answer) < 0)
+	G_fatal_error(_("Unable to open vector map <%s>"), in_opt->answer);
 
     /* check if we have a 3D input points map */
     mode3d = Vect_is_3d(&In);

Modified: grass/trunk/vector/v.distance/main.c
===================================================================
--- grass/trunk/vector/v.distance/main.c	2014-05-03 02:48:38 UTC (rev 60053)
+++ grass/trunk/vector/v.distance/main.c	2014-05-03 13:49:33 UTC (rev 60054)
@@ -288,7 +288,8 @@
 
     /* Open 'from' vector */
     Vect_set_open_level(2);
-    Vect_open_old2(&From, opt.from->answer, G_mapset(), opt.from_field->answer);
+    if (Vect_open_old2(&From, opt.from->answer, G_mapset(), opt.from_field->answer) < 0)
+	G_fatal_error(_("Unable to open vector map <%s>"), opt.from->answer);
 
     from_field = Vect_get_field_number(&From, opt.from_field->answer);
 
@@ -306,7 +307,8 @@
     
     /* Open 'to' vector */
     Vect_set_open_level(2);
-    Vect_open_old2(&To, opt.to->answer, "", opt.to_field->answer);
+    if (Vect_open_old2(&To, opt.to->answer, "", opt.to_field->answer) < 0)
+	G_fatal_error(_("Unable to open vector map <%s>"), opt.to->answer);
 
     ntolines = Vect_get_num_primitives(&To, to_type);
     ntoareas = 0;
@@ -326,7 +328,10 @@
 
     /* Open output vector */
     if (opt.out->answer) {
-	Vect_open_new(&Out, opt.out->answer, WITHOUT_Z);
+	if (Vect_open_new(&Out, opt.out->answer, WITHOUT_Z) < 0)
+	    G_fatal_error(_("Unable to create vector map <%s>"),
+			    opt.out->answer);
+
 	Vect_hist_command(&Out);
 	Outp = &Out;
     }

Modified: grass/trunk/vector/v.drape/main.c
===================================================================
--- grass/trunk/vector/v.drape/main.c	2014-05-03 02:48:38 UTC (rev 60053)
+++ grass/trunk/vector/v.drape/main.c	2014-05-03 13:49:33 UTC (rev 60054)
@@ -137,7 +137,10 @@
     
     /* open input vector map */
     Vect_set_open_level(2); /* topology required ? */
-    Vect_open_old2(&In, opt.input->answer, "", opt.layer->answer);
+
+    if (Vect_open_old2(&In, opt.input->answer, "", opt.layer->answer) < 0)
+	G_fatal_error(_("Unable to open vector map <%s>"), opt.input->answer);
+
     Vect_set_error_handler_io(&In, &Out);
     
     /* get layer number */
@@ -150,7 +153,9 @@
     }
 
     /* create output */
-    Vect_open_new(&Out, opt.output->answer, WITH_Z);
+    if (Vect_open_new(&Out, opt.output->answer, WITH_Z) < 0)
+	G_fatal_error(_("Unable to create vector map <%s>"),
+			opt.output->answer);
 
     Vect_copy_head_data(&In, &Out);
     Vect_hist_copy(&In, &Out);

Modified: grass/trunk/vector/v.edit/main.c
===================================================================
--- grass/trunk/vector/v.edit/main.c	2014-05-03 02:48:38 UTC (rev 60053)
+++ grass/trunk/vector/v.edit/main.c	2014-05-03 13:49:33 UTC (rev 60054)
@@ -235,7 +235,9 @@
 	    }
 	    Vect_close(&Map);
 
-	    Vect_open_update2(&Map, params.map->answer, G_mapset(), params.fld->answer);
+	    if (Vect_open_update2(&Map, params.map->answer, G_mapset(), params.fld->answer) < 0)
+		G_fatal_error(_("Unable to open vector map <%s>"),
+				params.map->answer);
 	}
     }
 

Modified: grass/trunk/vector/v.external/main.c
===================================================================
--- grass/trunk/vector/v.external/main.c	2014-05-03 02:48:38 UTC (rev 60053)
+++ grass/trunk/vector/v.external/main.c	2014-05-03 13:49:33 UTC (rev 60054)
@@ -142,7 +142,8 @@
     
     /* create new vector map */
     putenv("GRASS_VECTOR_EXTERNAL_IGNORE=1");
-    Vect_open_new(&Map, output, WITHOUT_Z); /* dimension is set later from data source */
+    if (Vect_open_new(&Map, output, WITHOUT_Z) < 0) /* dimension is set later from data source */
+	G_fatal_error(_("Unable to create vector map <%s>"), output);
     Vect_set_error_handler_io(NULL, &Map);
     
     Vect_hist_command(&Map);
@@ -186,7 +187,8 @@
     
     if (!flags.topo->answer) {
         Vect_set_open_level(1);
-        Vect_open_old(&Map, output, G_mapset());
+        if (Vect_open_old(&Map, output, G_mapset()) < 0)
+	    G_fatal_error(_("Unable to open vector map <%s>"), output);
         Vect_build(&Map);
         Vect_close(&Map);
     }

Modified: grass/trunk/vector/v.extract/main.c
===================================================================
--- grass/trunk/vector/v.extract/main.c	2014-05-03 02:48:38 UTC (rev 60053)
+++ grass/trunk/vector/v.extract/main.c	2014-05-03 13:49:33 UTC (rev 60054)
@@ -183,7 +183,9 @@
 
     /* Do initial read of input file */
     Vect_set_open_level(2); /* topology required */
-    Vect_open_old2(&In, input, "", opt.field->answer);
+
+    if (Vect_open_old2(&In, input, "", opt.field->answer) < 0)
+	G_fatal_error(_("Unable to open vector map <%s>"), input);
     
     field = Vect_get_field_number(&In, opt.field->answer);
     
@@ -341,7 +343,9 @@
 	qsort(cat_array, cat_count, sizeof(int), cmp);
     }
 
-    Vect_open_new(&Out, output, Vect_is_3d(&In));
+    if (Vect_open_new(&Out, output, Vect_is_3d(&In)) < 0)
+	G_fatal_error(_("Unable to create vector map <%s>"), output);
+
     Vect_hist_copy(&In, &Out);
     Vect_hist_command(&Out);
 

Modified: grass/trunk/vector/v.extrude/main.c
===================================================================
--- grass/trunk/vector/v.extrude/main.c	2014-05-03 02:48:38 UTC (rev 60053)
+++ grass/trunk/vector/v.extrude/main.c	2014-05-03 13:49:33 UTC (rev 60054)
@@ -184,12 +184,17 @@
     Cats = Vect_new_cats_struct();
 
     Vect_set_open_level(2); /* topology required for input */
+
     /* opening input vector map */
-    Vect_open_old2(&In, opt.input->answer, "", opt.field->answer);
+    if (Vect_open_old2(&In, opt.input->answer, "", opt.field->answer) < 0)
+	G_fatal_error(_("Unable to open vector map <%s>"), opt.input->answer);
+
     Vect_set_error_handler_io(&In, &Out);
 
     /* creating output vector map */
-    Vect_open_new(&Out, opt.output->answer, WITH_Z);
+    if (Vect_open_new(&Out, opt.output->answer, WITH_Z) < 0)
+	G_fatal_error(_("Unable to create vector map <%s>"),
+			opt.output->answer);
 
     field = Vect_get_field_number(&In, opt.field->answer);
 

Modified: grass/trunk/vector/v.in.ascii/main.c
===================================================================
--- grass/trunk/vector/v.in.ascii/main.c	2014-05-03 02:48:38 UTC (rev 60053)
+++ grass/trunk/vector/v.in.ascii/main.c	2014-05-03 13:49:33 UTC (rev 60054)
@@ -227,7 +227,9 @@
 	zcoor = 1;
     }
 
-    Vect_open_new(&Map, new->answer, zcoor);
+    if (Vect_open_new(&Map, new->answer, zcoor) < 0)
+	G_fatal_error(_("Unable to create vector map <%s>"), new->answer);
+
     Vect_set_error_handler_io(NULL, &Map);
     Vect_hist_command(&Map);
 

Modified: grass/trunk/vector/v.in.db/main.c
===================================================================
--- grass/trunk/vector/v.in.db/main.c	2014-05-03 02:48:38 UTC (rev 60053)
+++ grass/trunk/vector/v.in.db/main.c	2014-05-03 13:49:33 UTC (rev 60054)
@@ -129,7 +129,7 @@
 	Vect_set_open_level(1); /* no topo needed */
 
 	if (strcmp(mapset, G_mapset()) == 0 && G_find_vector2(name, mapset) &&
-	    Vect_open_old(&Map, name, mapset)) {
+	    Vect_open_old(&Map, name, mapset) >= 0) {
 	    int num_dblinks;
 
 	    num_dblinks = Vect_get_num_dblinks(&Map);
@@ -147,8 +147,8 @@
 	}
     }
 
-    if (Vect_open_new(&Map, outvect->answer, with_z) == -1)
-	G_fatal_error(_("Unable to create new vector map <%s>"),
+    if (Vect_open_new(&Map, outvect->answer, with_z) < 0)
+	G_fatal_error(_("Unable to create vector map <%s>"),
 			outvect->answer);
 
     Vect_set_error_handler_io(NULL, &Map);

Modified: grass/trunk/vector/v.in.dwg/main.c
===================================================================
--- grass/trunk/vector/v.in.dwg/main.c	2014-05-03 02:48:38 UTC (rev 60053)
+++ grass/trunk/vector/v.in.dwg/main.c	2014-05-03 13:49:33 UTC (rev 60054)
@@ -196,7 +196,8 @@
 
 
     /* open output vector */
-    Vect_open_new(&Map, out_opt->answer, z_flag->answer);
+    if (Vect_open_new(&Map, out_opt->answer, z_flag->answer) < 0)
+	G_fatal_error(_("Unable to create vector map <%s>"), out_opt->answer);
 
     Vect_hist_command(&Map);
 

Modified: grass/trunk/vector/v.in.lidar/main.c
===================================================================
--- grass/trunk/vector/v.in.lidar/main.c	2014-05-03 02:48:38 UTC (rev 60053)
+++ grass/trunk/vector/v.in.lidar/main.c	2014-05-03 13:49:33 UTC (rev 60054)
@@ -489,7 +489,8 @@
     sprintf(buf, "%s", out_opt->answer);
     /* strip any @mapset from vector output name */
     G_find_vector(buf, G_mapset());
-    Vect_open_new(&Map, out_opt->answer, 1);
+    if (Vect_open_new(&Map, out_opt->answer, 1) < 0)
+	G_fatal_error(_("Unable to create vector map <%s>"), out_opt->answer);
 
     Vect_hist_command(&Map);
     

Modified: grass/trunk/vector/v.in.ogr/main.c
===================================================================
--- grass/trunk/vector/v.in.ogr/main.c	2014-05-03 02:48:38 UTC (rev 60053)
+++ grass/trunk/vector/v.in.ogr/main.c	2014-05-03 13:49:33 UTC (rev 60054)
@@ -856,7 +856,10 @@
     /* open output vector */
     /* strip any @mapset from vector output name */
     G_find_vector(output, G_mapset());
-    Vect_open_new(&Map, output, with_z);
+
+    if (Vect_open_new(&Map, output, with_z) < 0)
+	G_fatal_error(_("Unable to create vector map <%s>"), output);
+
     Out = ⤅
 
     if (!flag.no_clean->answer) {
@@ -865,7 +868,9 @@
 	     * at the end copy alive lines to output vector
 	     * in case of polygons this reduces the coor file size by a factor of 2 to 5
 	     * only needed when cleaning polygons */
-	    Vect_open_tmp_new(&Tmp, NULL, with_z);
+	    if (Vect_open_tmp_new(&Tmp, NULL, with_z) < 0)
+		G_fatal_error(_("Unable to create temporary vector map"));
+
 	    G_verbose_message(_("Using temporary vector <%s>"), Vect_get_name(&Tmp));
 	    Out = &Tmp;
 	}

Modified: grass/trunk/vector/v.in.region/main.c
===================================================================
--- grass/trunk/vector/v.in.region/main.c	2014-05-03 02:48:38 UTC (rev 60053)
+++ grass/trunk/vector/v.in.region/main.c	2014-05-03 13:49:33 UTC (rev 60054)
@@ -71,7 +71,9 @@
     mid_long = (window.west + window.east) / 2;
 
     /* Open output segments */
-    Vect_open_new(&Out, out_opt->answer, 0);
+    if (Vect_open_new(&Out, out_opt->answer, 0) < 0)
+	G_fatal_error(_("Unable to create vector map <%s>"), out_opt->answer);
+
     Vect_hist_command(&Out);
 
     /* Rectangle */

Modified: grass/trunk/vector/v.in.sites/main.c
===================================================================
--- grass/trunk/vector/v.in.sites/main.c	2014-05-03 02:48:38 UTC (rev 60053)
+++ grass/trunk/vector/v.in.sites/main.c	2014-05-03 13:49:33 UTC (rev 60054)
@@ -119,7 +119,9 @@
     else
 	withz = 0;
 
-    Vect_open_new(&Map, outvect->answer, withz);
+    if (Vect_open_new(&Map, outvect->answer, withz) < 0)
+	G_fatal_error(_("Unable to create vector map <%s>"), outvect->answer);
+
     Vect_hist_command(&Map);
 
     fi = Vect_default_field_info(&Map, 1, NULL, GV_1TABLE);

Modified: grass/trunk/vector/v.kernel/main.c
===================================================================
--- grass/trunk/vector/v.kernel/main.c	2014-05-03 02:48:38 UTC (rev 60053)
+++ grass/trunk/vector/v.kernel/main.c	2014-05-03 13:49:33 UTC (rev 60054)
@@ -306,7 +306,8 @@
     
     /* Open input vector */
     Vect_set_open_level(2);
-    Vect_open_old(&In, in_opt->answer, "");
+    if (Vect_open_old(&In, in_opt->answer, "") < 0)
+	G_fatal_error(_("Unable to open vector map <%s>"), in_opt->answer);
 
     if (net_opt->answer) {
 	int nlines, line;
@@ -317,11 +318,16 @@
 	dimension = 1.;
 	/* Open input network */
 	Vect_set_open_level(2);
-	Vect_open_old(&Net, net_opt->answer, "");
+
+	if (Vect_open_old(&Net, net_opt->answer, "") < 0)
+	    G_fatal_error(_("Unable to open vector map <%s>"), net_opt->answer);
+
 	Vect_net_build_graph(&Net, GV_LINES, 0, 0, NULL, NULL, NULL, 0, 0);
 
 	if (!flag_q->answer) {
-	    Vect_open_new(&Out, out_opt->answer, 0);
+	    if (Vect_open_new(&Out, out_opt->answer, 0) < 0)
+		G_fatal_error(_("Unable to create vector map <%s>"),
+				out_opt->answer);
 	    Vect_hist_command(&Out);
 	}
 

Modified: grass/trunk/vector/v.label/main.c
===================================================================
--- grass/trunk/vector/v.label/main.c	2014-05-03 02:48:38 UTC (rev 60053)
+++ grass/trunk/vector/v.label/main.c	2014-05-03 13:49:33 UTC (rev 60054)
@@ -264,7 +264,8 @@
     }
 
     /* open vector */
-    Vect_open_old(&Map, Vectfile->answer, "");
+    if (Vect_open_old(&Map, Vectfile->answer, "") < 0)
+	G_fatal_error(_("Unable to open vector map <%s>"), Vectfile->answer);
 
     /* open database */
     field = atoi(Fieldopt->answer);

Modified: grass/trunk/vector/v.label.sa/labels.c
===================================================================
--- grass/trunk/vector/v.label.sa/labels.c	2014-05-03 02:48:38 UTC (rev 60053)
+++ grass/trunk/vector/v.label.sa/labels.c	2014-05-03 13:49:33 UTC (rev 60054)
@@ -54,7 +54,8 @@
     legal_types = Vect_option_to_types(p->type);
 
     /* open vector for read only */
-    Vect_open_old(&Map, p->map->answer, "");
+    if (Vect_open_old(&Map, p->map->answer, "") < 0)
+	G_fatal_error(_("Unable to open vector map <%s>"), p->map->answer);
 
     label_sz = Vect_get_num_primitives(&Map, legal_types);
 

Modified: grass/trunk/vector/v.lrs/v.lrs.create/main.c
===================================================================
--- grass/trunk/vector/v.lrs/v.lrs.create/main.c	2014-05-03 02:48:38 UTC (rev 60053)
+++ grass/trunk/vector/v.lrs/v.lrs.create/main.c	2014-05-03 13:49:33 UTC (rev 60054)
@@ -250,21 +250,29 @@
     if (mapset == NULL)
 	G_fatal_error(_("Vector map <%s> not found"), in_lines_opt->answer);
 
-    Vect_open_old(&In, in_lines_opt->answer, mapset);
+    if (Vect_open_old(&In, in_lines_opt->answer, mapset) < 0)
+	G_fatal_error(_("Unable to open vector map <%s>"),
+			in_lines_opt->answer);
 
     /* Open input ipoints */
     mapset = G_find_vector2(points_opt->answer, NULL);
     if (mapset == NULL)
 	G_fatal_error(_("Vector map <%s> not found"), points_opt->answer);
 
-    Vect_open_old(&PMap, points_opt->answer, mapset);
+    if (Vect_open_old(&PMap, points_opt->answer, mapset) < 0)
+	G_fatal_error(_("Unable to open vector map <%s>"), points_opt->answer);
 
     /* Open output lines */
-    Vect_open_new(&Out, out_lines_opt->answer, Vect_is_3d(&In));
+    if (Vect_open_new(&Out, out_lines_opt->answer, Vect_is_3d(&In)) < 0)
+	G_fatal_error(_("Unable to create vector map <%s>"),
+			out_lines_opt->answer);
 
     /* Open output error map */
-    if (err_opt->answer)
-	Vect_open_new(&EMap, err_opt->answer, Vect_is_3d(&In));
+    if (err_opt->answer) {
+	if (Vect_open_new(&EMap, err_opt->answer, Vect_is_3d(&In)) < 0)
+	    G_fatal_error(_("Unable to create vector map <%s>"),
+			    err_opt->answer);
+    }
 
     /* Because the line feature identified by one id (lidcol) may be split
      *  to more line parts, and milepost may be in threshold for more such parts,

Modified: grass/trunk/vector/v.lrs/v.lrs.label/main.c
===================================================================
--- grass/trunk/vector/v.lrs/v.lrs.label/main.c	2014-05-03 02:48:38 UTC (rev 60053)
+++ grass/trunk/vector/v.lrs/v.lrs.label/main.c	2014-05-03 13:49:33 UTC (rev 60054)
@@ -287,10 +287,12 @@
 	G_fatal_error(_("Vector map <%s> not found"), in_opt->answer);
 
     Vect_set_open_level(2);
-    Vect_open_old(&In, in_opt->answer, mapset);
+    if (Vect_open_old(&In, in_opt->answer, mapset) < 0)
+	G_fatal_error(_("Unable to open vector map <%s>"), in_opt->answer);
 
     /* Open output segments */
-    Vect_open_new(&Out, out_opt->answer, Vect_is_3d(&In));
+    if (Vect_open_new(&Out, out_opt->answer, Vect_is_3d(&In)) < 0)
+	G_fatal_error(_("Unable to create vector map <%s>"), out_opt->answer);
 
     /* open labels */
     labels = NULL;

Modified: grass/trunk/vector/v.lrs/v.lrs.segment/main.c
===================================================================
--- grass/trunk/vector/v.lrs/v.lrs.segment/main.c	2014-05-03 02:48:38 UTC (rev 60053)
+++ grass/trunk/vector/v.lrs/v.lrs.segment/main.c	2014-05-03 13:49:33 UTC (rev 60054)
@@ -140,10 +140,12 @@
 	G_fatal_error(_("Vector map <%s> not found"), in_opt->answer);
 
     Vect_set_open_level(2);
-    Vect_open_old(&In, in_opt->answer, mapset);
+    if (Vect_open_old(&In, in_opt->answer, mapset) < 0)
+	G_fatal_error(_("Unable to open vector map <%s>"), in_opt->answer);
 
     /* Open output segments */
-    Vect_open_new(&Out, out_opt->answer, Vect_is_3d(&In));
+    if (Vect_open_new(&Out, out_opt->answer, Vect_is_3d(&In)) < 0)
+	G_fatal_error(_("Unable to create vector map <%s>"), out_opt->answer);
 
     db_init_handle(&rshandle);
     db_init_string(&rsstmt);

Modified: grass/trunk/vector/v.lrs/v.lrs.where/main.c
===================================================================
--- grass/trunk/vector/v.lrs/v.lrs.where/main.c	2014-05-03 02:48:38 UTC (rev 60053)
+++ grass/trunk/vector/v.lrs/v.lrs.where/main.c	2014-05-03 13:49:33 UTC (rev 60054)
@@ -127,7 +127,8 @@
 	G_fatal_error(_("Vector map <%s> not found"), lines_opt->answer);
 
     Vect_set_open_level(2);
-    Vect_open_old(&LMap, lines_opt->answer, mapset);
+    if (Vect_open_old(&LMap, lines_opt->answer, mapset) < 0)
+	G_fatal_error(_("Unable to open vector map <%s>"), lines_opt->answer);
 
     /* Open input points */
     mapset = G_find_vector2(points_opt->answer, NULL);
@@ -135,7 +136,8 @@
 	G_fatal_error(_("Vector map <%s> not found"), points_opt->answer);
 
     Vect_set_open_level(2);
-    Vect_open_old(&PMap, points_opt->answer, mapset);
+    if (Vect_open_old(&PMap, points_opt->answer, mapset) < 0)
+	G_fatal_error(_("Unable to open vector map <%s>"), points_opt->answer);
 
     db_init_handle(&rshandle);
     db_init_string(&rsstmt);

Modified: grass/trunk/vector/v.neighbors/main.c
===================================================================
--- grass/trunk/vector/v.neighbors/main.c	2014-05-03 02:48:38 UTC (rev 60053)
+++ grass/trunk/vector/v.neighbors/main.c	2014-05-03 13:49:33 UTC (rev 60054)
@@ -83,7 +83,9 @@
 
     /* open input vector */
     Vect_set_open_level(2);
-    Vect_open_old2(&In, in_opt->answer, "", field_opt->answer);
+    if (Vect_open_old2(&In, in_opt->answer, "", field_opt->answer) < 0)
+	G_fatal_error(_("Unable to open vector map <%s>"), in_opt->answer);
+
     field = Vect_get_field_number(&In, field_opt->answer);
 
     G_get_set_window(&region);

Modified: grass/trunk/vector/v.net.alloc/main.c
===================================================================
--- grass/trunk/vector/v.net.alloc/main.c	2014-05-03 02:48:38 UTC (rev 60053)
+++ grass/trunk/vector/v.net.alloc/main.c	2014-05-03 13:49:33 UTC (rev 60054)
@@ -137,7 +137,8 @@
 	geo = 0;
 
     Vect_set_open_level(2);
-    Vect_open_old(&Map, map->answer, "");
+    if (Vect_open_old(&Map, map->answer, "") < 0)
+	G_fatal_error(_("Unable to open vector map <%s>"), map->answer);
 
     afield = Vect_get_field_number(&Map, afield_opt->answer);
     nfield = Vect_get_field_number(&Map, nfield_opt->answer);
@@ -238,7 +239,9 @@
     G_percent(1, 1, 1);
 
     /* Write arcs to new map */
-    Vect_open_new(&Out, output->answer, Vect_is_3d(&Map));
+    if (Vect_open_new(&Out, output->answer, Vect_is_3d(&Map)) < 0)
+	G_fatal_error(_("Unable to create vector map <%s>"), output->answer);
+
     Vect_hist_command(&Out);
 
     nlines = Vect_get_num_lines(&Map);

Modified: grass/trunk/vector/v.net.iso/main.c
===================================================================
--- grass/trunk/vector/v.net.iso/main.c	2014-05-03 02:48:38 UTC (rev 60053)
+++ grass/trunk/vector/v.net.iso/main.c	2014-05-03 13:49:33 UTC (rev 60054)
@@ -177,8 +177,10 @@
 	geo = 0;
 
     Vect_set_open_level(2);
-    Vect_open_old(&Map, map->answer, "");
 
+    if (Vect_open_old(&Map, map->answer, "") < 0)
+	G_fatal_error(_("Unable to open vector map <%s>"), map->answer);
+
     /* Build graph */
     Vect_net_build_graph(&Map, type, afield, nfield, afcol->answer,
 			 abcol->answer, ncol->answer, geo, 0);
@@ -274,7 +276,9 @@
     }
 
     /* Write arcs to new map */
-    Vect_open_new(&Out, output->answer, Vect_is_3d(&Map));
+    if (Vect_open_new(&Out, output->answer, Vect_is_3d(&Map)) < 0)
+	G_fatal_error(_("Unable to create vector map <%s>"), output->answer);
+
     Vect_hist_command(&Out);
 
     G_message("Generating isolines...");

Modified: grass/trunk/vector/v.net.path/main.c
===================================================================
--- grass/trunk/vector/v.net.path/main.c	2014-05-03 02:48:38 UTC (rev 60053)
+++ grass/trunk/vector/v.net.path/main.c	2014-05-03 13:49:33 UTC (rev 60054)
@@ -127,7 +127,8 @@
 				 G_FATAL_EXIT);
 
     Vect_set_open_level(2);
-    Vect_open_old(&In, input_opt->answer, "");
+    if (Vect_open_old(&In, input_opt->answer, "") < 0)
+	G_fatal_error(_("Unable to open vector map <%s>"), input_opt->answer);
 
     if (1 > Vect_open_new(&Out, output_opt->answer, Vect_is_3d(&In))) {
 	Vect_close(&In);

Modified: grass/trunk/vector/v.net.salesman/main.c
===================================================================
--- grass/trunk/vector/v.net.salesman/main.c	2014-05-03 02:48:38 UTC (rev 60053)
+++ grass/trunk/vector/v.net.salesman/main.c	2014-05-03 13:49:33 UTC (rev 60054)
@@ -219,7 +219,10 @@
     Vect_check_input_output_name(map->answer, output->answer, G_FATAL_EXIT);
 
     Vect_set_open_level(2);
-    Vect_open_old(&Map, map->answer, "");
+
+    if (Vect_open_old(&Map, map->answer, "") < 0)
+	G_fatal_error(_("Unable to open vector map <%s>"), map->answer);
+
     nnodes = Vect_get_num_nodes(&Map);
     nlines = Vect_get_num_lines(&Map);
 
@@ -485,7 +488,9 @@
     }
 
     /* Write arcs to new map */
-    Vect_open_new(&Out, output->answer, Vect_is_3d(&Map));
+    if (Vect_open_new(&Out, output->answer, Vect_is_3d(&Map)) < 0)
+	G_fatal_error(_("Unable to create vector map <%s>"), output->answer);
+
     Vect_hist_command(&Out);
 
     G_verbose_message(_("Cycle with total cost %.3f"), cost);

Modified: grass/trunk/vector/v.net.steiner/main.c
===================================================================
--- grass/trunk/vector/v.net.steiner/main.c	2014-05-03 02:48:38 UTC (rev 60053)
+++ grass/trunk/vector/v.net.steiner/main.c	2014-05-03 13:49:33 UTC (rev 60054)
@@ -425,7 +425,10 @@
     Vect_check_input_output_name(map->answer, output->answer, G_FATAL_EXIT);
 
     Vect_set_open_level(2);
-    Vect_open_old(&Map, map->answer, "");
+
+    if (Vect_open_old(&Map, map->answer, "") < 0)
+	G_fatal_error(_("Unable to open vector map <%s>"), map->answer);
+
     nnodes = Vect_get_num_nodes(&Map);
     nlines = Vect_get_num_lines(&Map);
 
@@ -594,7 +597,9 @@
 	fprintf(stdout, "\nSteiner tree costs = %f\n", cost);
 
     /* Write arcs to new map */
-    Vect_open_new(&Out, output->answer, Vect_is_3d(&Map));
+    if (Vect_open_new(&Out, output->answer, Vect_is_3d(&Map)) < 0)
+	G_fatal_error(_("Unable to create vector map <%s>"), output->answer);
+
     Vect_hist_command(&Out);
 
     fprintf(stdout, "\nSteiner tree:\n");

Modified: grass/trunk/vector/v.normal/main.c
===================================================================
--- grass/trunk/vector/v.normal/main.c	2014-05-03 02:48:38 UTC (rev 60053)
+++ grass/trunk/vector/v.normal/main.c	2014-05-03 13:49:33 UTC (rev 60054)
@@ -107,7 +107,9 @@
 
     /* Open input */
     Vect_set_open_level(2);
-    Vect_open_old2(&Map, parm.input->answer, "", parm.layer->answer);
+    if (Vect_open_old2(&Map, parm.input->answer, "", parm.layer->answer) < 0)
+	G_fatal_error(_("Unable to open vector map <%s>"), parm.input->answer);
+
     field = Vect_get_field_number(&Map, parm.layer->answer);
     
     /* Read attributes */

Modified: grass/trunk/vector/v.out.dxf/main.c
===================================================================
--- grass/trunk/vector/v.out.dxf/main.c	2014-05-03 02:48:38 UTC (rev 60053)
+++ grass/trunk/vector/v.out.dxf/main.c	2014-05-03 13:49:33 UTC (rev 60054)
@@ -75,7 +75,8 @@
     dxf_file = G_store(output->answer);
 
     Vect_set_open_level(2);
-    Vect_open_old2(&In, input->answer, "", field->answer);
+    if (Vect_open_old2(&In, input->answer, "", field->answer) < 0)
+	G_fatal_error(_("Unable to open vector map <%s>"), input->answer);
 
     dxf_open(dxf_file);		/* open output */
 

Modified: grass/trunk/vector/v.out.ogr/main.c
===================================================================
--- grass/trunk/vector/v.out.ogr/main.c	2014-05-03 02:48:38 UTC (rev 60053)
+++ grass/trunk/vector/v.out.ogr/main.c	2014-05-03 13:49:33 UTC (rev 60054)
@@ -123,7 +123,10 @@
     if (!flags.new->answer) {
 	/* open input vector (topology required) */
 	Vect_set_open_level(2);
-	Vect_open_old2(&In, options.input->answer, "", options.field->answer);
+	if (Vect_open_old2(&In, options.input->answer, "",
+				options.field->answer) < 0)
+	    G_fatal_error(_("Unable to open vector map <%s>"),
+			    options.input->answer);
 
 	if (strcmp(options.type->answer, "auto") == 0) {
 	    G_debug(2, "Automatic type determination.");

Modified: grass/trunk/vector/v.out.pov/main.c
===================================================================
--- grass/trunk/vector/v.out.pov/main.c	2014-05-03 02:48:38 UTC (rev 60053)
+++ grass/trunk/vector/v.out.pov/main.c	2014-05-03 13:49:33 UTC (rev 60054)
@@ -93,7 +93,8 @@
 
     /* open input vector */
     Vect_set_open_level(2);
-    Vect_open_old2(&In, in_opt->answer, "", field_opt->answer);
+    if (Vect_open_old2(&In, in_opt->answer, "", field_opt->answer) < 0)
+	G_fatal_error(_("Unable to open vector map <%s>"), in_opt->answer);
     
     field = Vect_get_field_number(&In, field_opt->answer);
     

Modified: grass/trunk/vector/v.out.svg/main.c
===================================================================
--- grass/trunk/vector/v.out.svg/main.c	2014-05-03 02:48:38 UTC (rev 60053)
+++ grass/trunk/vector/v.out.svg/main.c	2014-05-03 13:49:33 UTC (rev 60054)
@@ -135,7 +135,8 @@
 
     /* open input vector */
     Vect_set_open_level(2);
-    Vect_open_old2(&In, in_opt->answer, "", field_opt->answer);
+    if (Vect_open_old2(&In, in_opt->answer, "", field_opt->answer) < 0)
+	G_fatal_error(_("Unable to open vector map <%s>"), in_opt->answer);
 
     /* parse field number */
     field = Vect_get_field_number(&In, field_opt->answer);

Modified: grass/trunk/vector/v.overlay/main.c
===================================================================
--- grass/trunk/vector/v.overlay/main.c	2014-05-03 02:48:38 UTC (rev 60053)
+++ grass/trunk/vector/v.overlay/main.c	2014-05-03 13:49:33 UTC (rev 60054)
@@ -174,7 +174,9 @@
 
     for (input = 0; input < 2; input++) {
         Vect_set_open_level(2);
-        Vect_open_old2(&(In[input]), in_opt[input]->answer, "", field_opt[input]->answer);
+        if (Vect_open_old2(&(In[input]), in_opt[input]->answer, "", field_opt[input]->answer) < 0)
+	    G_fatal_error(_("Unable to open vector map <%s>"),
+			    in_opt[input]->answer);
 	field[input] = Vect_get_field_number(&(In[input]), field_opt[input]->answer);
     }
     if (type[0] == 0) { /* atype=auto */
@@ -204,12 +206,15 @@
     Cats = Vect_new_cats_struct();
 
     /* Open output */
-    Vect_open_new(&Out, out_opt->answer, WITHOUT_Z);
+    if (Vect_open_new(&Out, out_opt->answer, WITHOUT_Z) < 0)
+	G_fatal_error(_("Unable to create vector map <%s>"), out_opt->answer);
+
     Vect_set_map_name(&Out, "Output from v.overlay");
     Vect_set_person(&Out, G_whoami());
     Vect_hist_command(&Out);
     
-    Vect_open_tmp_new(&Tmp, NULL, WITHOUT_Z);
+    if (Vect_open_tmp_new(&Tmp, NULL, WITHOUT_Z) < 0)
+	G_fatal_error(_("Unable to create temporary vector map"));
 
     /* Create dblinks */
     if (ofield[0] > 0) {

Modified: grass/trunk/vector/v.parallel/main.c
===================================================================
--- grass/trunk/vector/v.parallel/main.c	2014-05-03 02:48:38 UTC (rev 60053)
+++ grass/trunk/vector/v.parallel/main.c	2014-05-03 13:49:33 UTC (rev 60054)
@@ -142,10 +142,14 @@
 	side = 0;
 
     Vect_set_open_level(2);
-    Vect_open_old2(&In, in_opt->answer, "", layer_opt->answer);
+
+    if (Vect_open_old2(&In, in_opt->answer, "", layer_opt->answer) < 0)
+	G_fatal_error(_("Unable to open vector map <%s>"), in_opt->answer);
+
     layer = Vect_get_field_number(&In, layer_opt->answer);
 
-    Vect_open_new(&Out, out_opt->answer, 0);
+    if (Vect_open_new(&Out, out_opt->answer, 0) < 0)
+	G_fatal_error(_("Unable to create vector map <%s>"), out_opt->answer);
     
     Vect_copy_head_data(&In, &Out);
     Vect_hist_copy(&In, &Out);

Modified: grass/trunk/vector/v.patch/main.c
===================================================================
--- grass/trunk/vector/v.patch/main.c	2014-05-03 02:48:38 UTC (rev 60053)
+++ grass/trunk/vector/v.patch/main.c	2014-05-03 13:49:33 UTC (rev 60054)
@@ -110,7 +110,8 @@
 	Vect_check_input_output_name(in_name, new->answer, G_FATAL_EXIT);
 
 	Vect_set_open_level(2);
-	Vect_open_old_head(&InMap, in_name, "");
+	if (Vect_open_old_head(&InMap, in_name, "") < 0)
+	    G_fatal_error(_("Unable to open vector map <%s>"), in_name);
 
 	if (out_is_3d != WITH_Z && Vect_is_3d(&InMap))
 	    out_is_3d = WITH_Z;
@@ -123,7 +124,8 @@
     if (do_table) {
 	if (append->answer) {
 	    Vect_set_open_level(1);
-	    Vect_open_old_head(&OutMap, out_name, G_mapset());
+	    if (Vect_open_old_head(&OutMap, out_name, G_mapset()) < 0)
+		G_fatal_error(_("Unable to open vector map <%s>"), out_name);
 
 	    fi_out = Vect_get_field(&OutMap, 1);
 	    if (fi_out) {
@@ -151,7 +153,8 @@
 	while (old->answers[i]) {
 	    in_name = old->answers[i];
 	    Vect_set_open_level(1);
-	    Vect_open_old_head(&InMap, in_name, "");
+	    if (Vect_open_old_head(&InMap, in_name, "") < 0)
+		G_fatal_error(_("Unable to open vector map <%s>"), in_name);
 
 	    fi_in = Vect_get_field(&InMap, 1);
 	    table_in = NULL;
@@ -245,18 +248,23 @@
     if (append->answer) {
 	if (no_topo->answer)
 	    Vect_set_open_level(1);
-	Vect_open_update(&OutMap, out_name, G_mapset());
+
+	if (Vect_open_update(&OutMap, out_name, G_mapset()) < 0)
+	    G_fatal_error(_("Unable to open vector map <%s>"), out_name);
+
 	if (out_is_3d == WITH_Z && !Vect_is_3d(&OutMap)) {
 	    G_warning(_("The output map is not 3D"));
 	}
 	maxcat = max_cat(&OutMap, 1);
     }
     else {
-	Vect_open_new(&OutMap, out_name, out_is_3d);
+	if (Vect_open_new(&OutMap, out_name, out_is_3d) < 0)
+	    G_fatal_error(_("Unable to create vector map <%s>"), out_name);
     }
 
     if (bbox_name) {
-	Vect_open_new(&BBoxMap, bbox_name, out_is_3d);	/* TODO 3D */
+	if (Vect_open_new(&BBoxMap, bbox_name, out_is_3d) < 0)	/* TODO 3D */
+	    G_fatal_error(_("Unable to create vector map <%s>"), bbox_name);
 	Vect_hist_command(&BBoxMap);
     }
 
@@ -316,7 +324,8 @@
 	    Vect_set_open_level(2);	/* needed for Vect_map_box() */
 	else
 	    Vect_set_open_level(1);
-	Vect_open_old(&InMap, in_name, "");
+	if (Vect_open_old(&InMap, in_name, "") < 0)
+	    G_fatal_error(_("Unable to open vector map <%s>"), in_name);
 
 	/*first time around, copy first in head to out head */
 	if (i == 1)

Modified: grass/trunk/vector/v.perturb/main.c
===================================================================
--- grass/trunk/vector/v.perturb/main.c	2014-05-03 02:48:38 UTC (rev 60053)
+++ grass/trunk/vector/v.perturb/main.c	2014-05-03 13:49:33 UTC (rev 60054)
@@ -141,12 +141,14 @@
 
     /* Open input */
     Vect_set_open_level(2);
-    Vect_open_old_head2(&In, parm.in->answer, "", parm.field->answer);
+    if (Vect_open_old_head2(&In, parm.in->answer, "", parm.field->answer) < 0)
+	G_fatal_error(_("Unable to open vector map <%s>"), parm.in->answer);
     
     field = Vect_get_field_number(&In, parm.field->answer);
     
     /* Open output */
-    Vect_open_new(&Out, parm.out->answer, WITHOUT_Z);	/* TODO add z support ? */
+    if (Vect_open_new(&Out, parm.out->answer, WITHOUT_Z) < 0)	/* TODO add z support ? */
+	G_fatal_error(_("Unable to create vector map <%s>"), parm.out->answer);
 
     Vect_hist_copy(&In, &Out);
     Vect_hist_command(&Out);
@@ -164,7 +166,8 @@
     /* Close input, re-open on level 1 */
     Vect_close(&In);
     Vect_set_open_level(1);
-    Vect_open_old2(&In, parm.in->answer, "", parm.field->answer);
+    if (Vect_open_old2(&In, parm.in->answer, "", parm.field->answer) < 0)
+	G_fatal_error(_("Unable to open vector map <%s>"), parm.in->answer);
 
     i = 0;
     line = 0;

Modified: grass/trunk/vector/v.proj/main.c
===================================================================
--- grass/trunk/vector/v.proj/main.c	2014-05-03 02:48:38 UTC (rev 60053)
+++ grass/trunk/vector/v.proj/main.c	2014-05-03 13:49:33 UTC (rev 60054)
@@ -220,7 +220,8 @@
 	Vect_set_open_level(1);
 	G_debug(1, "Open old: location: %s mapset : %s", G_location_path(),
 		G_mapset());
-	Vect_open_old(&Map, map_name, mapset);
+	if (Vect_open_old(&Map, map_name, mapset) < 0)
+	    G_fatal_error(_("Unable to open vector map <%s>"), map_name);
     }
     else if (stat < 0)
     {				/* allow 0 (i.e. denied permission) */
@@ -360,7 +361,10 @@
 
     G_debug(1, "Open new: location: %s mapset : %s", G_location_path(),
 	    G_mapset());
-    Vect_open_new(&Out_Map, omap_name, Vect_is_3d(&Map));
+
+    if (Vect_open_new(&Out_Map, omap_name, Vect_is_3d(&Map)) < 0)
+	G_fatal_error(_("Unable to create vector map <%s>"), omap_name);
+
     Vect_set_error_handler_io(NULL, &Out_Map); /* register standard i/o error handler */
     
     Vect_copy_head_data(&Map, &Out_Map);

Modified: grass/trunk/vector/v.qcount/main.c
===================================================================
--- grass/trunk/vector/v.qcount/main.c	2014-05-03 02:48:38 UTC (rev 60053)
+++ grass/trunk/vector/v.qcount/main.c	2014-05-03 13:49:33 UTC (rev 60054)
@@ -96,7 +96,8 @@
 
     /* Open input */
     Vect_set_open_level(2);
-    Vect_open_old2(&Map, parm.input->answer, "", parm.field->answer);
+    if (Vect_open_old2(&Map, parm.input->answer, "", parm.field->answer) < 0)
+	G_fatal_error(_("Unable to open vector map <%s>"), parm.input->answer);
 
     /* Get the quadrats */
     G_message(_("Finding quadrats..."));
@@ -121,7 +122,10 @@
 	Points = Vect_new_line_struct();
 	Cats = Vect_new_cats_struct();
 
-	Vect_open_new(&Out, parm.output->answer, 0);
+	if (Vect_open_new(&Out, parm.output->answer, 0) < 0)
+	    G_fatal_error(_("Unable to create vector map <%s>"),
+			    parm.output->answer);
+
 	Vect_hist_command(&Out);
 
 	for (i = 0; i < nquads; i++) {

Modified: grass/trunk/vector/v.reclass/main.c
===================================================================
--- grass/trunk/vector/v.reclass/main.c	2014-05-03 02:48:38 UTC (rev 60053)
+++ grass/trunk/vector/v.reclass/main.c	2014-05-03 13:49:33 UTC (rev 60054)
@@ -109,10 +109,13 @@
 				 G_FATAL_EXIT);
 
     Vect_set_open_level(2);
-    Vect_open_old2(&In, in_opt->answer, "", field_opt->answer);
+    if (Vect_open_old2(&In, in_opt->answer, "", field_opt->answer) < 0)
+	G_fatal_error(_("Unable to open vector map <%s>"), in_opt->answer);
     field = Vect_get_field_number(&In, field_opt->answer);
 
-    Vect_open_new(&Out, out_opt->answer, Vect_is_3d(&In));
+    if (Vect_open_new(&Out, out_opt->answer, Vect_is_3d(&In)) < 0)
+	G_fatal_error(_("Unable to create vector map <%s>"), out_opt->answer);
+
     Vect_copy_head_data(&In, &Out);
     Vect_hist_copy(&In, &Out);
     Vect_hist_command(&Out);

Modified: grass/trunk/vector/v.rectify/main.c
===================================================================
--- grass/trunk/vector/v.rectify/main.c	2014-05-03 02:48:38 UTC (rev 60053)
+++ grass/trunk/vector/v.rectify/main.c	2014-05-03 13:49:33 UTC (rev 60054)
@@ -144,7 +144,8 @@
 		      MAXORDER);
 
     Vect_set_open_level(1);
-    Vect_open_old2(&In, in_opt->answer, "", "");
+    if (Vect_open_old2(&In, in_opt->answer, "", "") < 0)
+	G_fatal_error(_("Unable to open vector map <%s>"), in_opt->answer);
     
     use3d = (Vect_is_3d(&In) &&
              (flag_use3d->answer || ortho->answer));
@@ -221,7 +222,10 @@
 	G_debug(1, "Overwriting OK");
 
     select_target_env();
-    Vect_open_new(&Out, out_opt->answer, Vect_is_3d(&In));
+
+    if (Vect_open_new(&Out, out_opt->answer, Vect_is_3d(&In)) < 0)
+	G_fatal_error(_("Unable to create vector map <%s>"), out_opt->answer);
+
     Vect_copy_head_data(&In, &Out);
     Vect_hist_copy(&In, &Out);
     Vect_hist_command(&Out);

Modified: grass/trunk/vector/v.sample/main.c
===================================================================
--- grass/trunk/vector/v.sample/main.c	2014-05-03 02:48:38 UTC (rev 60053)
+++ grass/trunk/vector/v.sample/main.c	2014-05-03 13:49:33 UTC (rev 60054)
@@ -119,7 +119,10 @@
 
     /* Open input */
     Vect_set_open_level(2);
-    Vect_open_old2(&In, parm.input->answer, "", parm.field->answer);
+
+    if (Vect_open_old2(&In, parm.input->answer, "", parm.field->answer) < 0)
+	G_fatal_error(_("Unable to open vector map <%s>"), parm.input->answer);
+
     field = Vect_get_field_number(&In, parm.field->answer);
     
     fdrast = Rast_open_old(parm.rast->answer, "");
@@ -154,7 +157,10 @@
     db_close_database_shutdown_driver(Driver);
 
     /* Open output */
-    Vect_open_new(&Out, parm.output->answer, 0);
+    if (Vect_open_new(&Out, parm.output->answer, 0) < 0)
+	G_fatal_error(_("Unable to create vector map <%s>"),
+			parm.output->answer);
+
     Vect_hist_copy(&In, &Out);
     Vect_hist_command(&Out);
 

Modified: grass/trunk/vector/v.segment/main.c
===================================================================
--- grass/trunk/vector/v.segment/main.c	2014-05-03 02:48:38 UTC (rev 60053)
+++ grass/trunk/vector/v.segment/main.c	2014-05-03 13:49:33 UTC (rev 60054)
@@ -99,11 +99,16 @@
 
     /* Open input lines */
     Vect_set_open_level(2);
-    Vect_open_old2(&In, in_opt->answer, "", lfield_opt->answer);
+
+    if (Vect_open_old2(&In, in_opt->answer, "", lfield_opt->answer) < 0)
+	G_fatal_error(_("Unable to open vector map <%s>"), in_opt->answer);
+
     lfield = Vect_get_field_number(&In, lfield_opt->answer);
 
     /* Open output segments */
-    Vect_open_new(&Out, out_opt->answer, Vect_is_3d(&In));
+    if (Vect_open_new(&Out, out_opt->answer, Vect_is_3d(&In)) < 0)
+	G_fatal_error(_("Unable to create vector map <%s>"), out_opt->answer);
+
     Vect_hist_copy(&In, &Out);
     Vect_hist_command(&Out);
 

Modified: grass/trunk/vector/v.select/main.c
===================================================================
--- grass/trunk/vector/v.select/main.c	2014-05-03 02:48:38 UTC (rev 60053)
+++ grass/trunk/vector/v.select/main.c	2014-05-03 13:49:33 UTC (rev 60054)
@@ -101,7 +101,12 @@
 				     G_FATAL_EXIT);
 
 	Vect_set_open_level(2);
-	Vect_open_old2(&(In[iopt]), parm.input[iopt]->answer, "", parm.field[iopt]->answer);
+
+	if (Vect_open_old2(&(In[iopt]), parm.input[iopt]->answer, "",
+				parm.field[iopt]->answer) < 0)
+	    G_fatal_error(_("Unable to open vector map <%s>"),
+			    parm.input[iopt]->answer);
+
 	ifield[iopt] = Vect_get_field_number(&(In[iopt]), parm.field[iopt]->answer);
     }
 
@@ -112,7 +117,10 @@
     IFi = Vect_get_field(&(In[0]), ifield[0]);
 
     /* Open output */
-    Vect_open_new(&Out, parm.output->answer, Vect_is_3d(&(In[0])));
+    if (Vect_open_new(&Out, parm.output->answer, Vect_is_3d(&(In[0]))) < 0)
+	G_fatal_error(_("Unable to create vector map <%s>"),
+			parm.output->answer);
+
     Vect_set_map_name(&Out, _("Output from v.select"));
     Vect_set_person(&Out, G_whoami());
     Vect_copy_head_data(&(In[0]), &Out);

Modified: grass/trunk/vector/v.split/main.c
===================================================================
--- grass/trunk/vector/v.split/main.c	2014-05-03 02:48:38 UTC (rev 60053)
+++ grass/trunk/vector/v.split/main.c	2014-05-03 13:49:33 UTC (rev 60054)
@@ -156,10 +156,14 @@
     nosplit = nosplit_flag->answer;
     
     Vect_set_open_level(2);
-    Vect_open_old2(&In, in_opt->answer, "", layer_opt->answer);
+
+    if (Vect_open_old2(&In, in_opt->answer, "", layer_opt->answer) < 0)
+	G_fatal_error(_("Unable to open vector map <%s>"), in_opt->answer);
+
     layer = Vect_get_field_number(&In, layer_opt->answer);
     
-    Vect_open_new(&Out, out_opt->answer, Vect_is_3d(&In));
+    if (Vect_open_new(&Out, out_opt->answer, Vect_is_3d(&In)) < 0)
+	G_fatal_error(_("Unable to create vector map <%s>"), out_opt->answer);
     
     Vect_copy_head_data(&In, &Out);
     Vect_hist_copy(&In, &Out);

Modified: grass/trunk/vector/v.surf.idw/read_sites.c
===================================================================
--- grass/trunk/vector/v.surf.idw/read_sites.c	2014-05-03 02:48:38 UTC (rev 60053)
+++ grass/trunk/vector/v.surf.idw/read_sites.c	2014-05-03 13:49:33 UTC (rev 60054)
@@ -25,7 +25,9 @@
     struct line_cats *Cats;
 
     Vect_set_open_level(1);	/* without topology */
-    Vect_open_old2(&Map, name, "", field_name);
+    if (Vect_open_old2(&Map, name, "", field_name) < 0)
+	G_fatal_error(_("Unable to open vector map <%s>"), name);
+
     field = Vect_get_field_number(&Map, field_name);
     with_z = col == NULL && Vect_is_3d(&Map); /* read z-coordinates
                                                  only when column is

Modified: grass/trunk/vector/v.surf.rst/main.c
===================================================================
--- grass/trunk/vector/v.surf.rst/main.c	2014-05-03 02:48:38 UTC (rev 60053)
+++ grass/trunk/vector/v.surf.rst/main.c	2014-05-03 13:49:33 UTC (rev 60054)
@@ -565,10 +565,13 @@
 	Cats2 = Vect_new_cats_struct();
 	db_init_string(&sql2);
 
-	if (devi != NULL)
-	    Vect_open_new(&Map2, devi, 1);
-	else
-	    Vect_open_new(&Map2, cvdev, 1);
+	if (devi != NULL) {
+	    if (Vect_open_new(&Map2, devi, 1) < 0)
+		G_fatal_error(_("Unable to create vector map <%s>"), devi);
+	} else {
+	    if (Vect_open_new(&Map2, cvdev, 1) < 0)
+		G_fatal_error(_("Unable to create vector map <%s>"), cvdev);
+	}
 	Vect_hist_command(&Map2);
 	ff = Vect_default_field_info(&Map2, 1, NULL, GV_1TABLE);
 	Vect_map_add_dblink(&Map2, 1, NULL, ff->table, GV_KEY_COLUMN, ff->database,

Modified: grass/trunk/vector/v.to.db/main.c
===================================================================
--- grass/trunk/vector/v.to.db/main.c	2014-05-03 02:48:38 UTC (rev 60053)
+++ grass/trunk/vector/v.to.db/main.c	2014-05-03 13:49:33 UTC (rev 60054)
@@ -45,7 +45,8 @@
 
     /* open map */
     Vect_set_open_level(2);
-    Vect_open_old(&Map, options.name, "");
+    if (Vect_open_old(&Map, options.name, "") < 0)
+	G_fatal_error(_("Unable to open vector map <%s>"), options.name);
 
     Fi = Vect_get_field(&Map, options.field);
 

Modified: grass/trunk/vector/v.to.points/main.c
===================================================================
--- grass/trunk/vector/v.to.points/main.c	2014-05-03 02:48:38 UTC (rev 60053)
+++ grass/trunk/vector/v.to.points/main.c	2014-05-03 13:49:33 UTC (rev 60054)
@@ -116,13 +116,19 @@
 
     /* Open input lines */
     Vect_set_open_level(2);
-    Vect_open_old2(&In, opt.input->answer, "", opt.lfield->answer);
+
+    if (Vect_open_old2(&In, opt.input->answer, "", opt.lfield->answer) < 0)
+	G_fatal_error(_("Unable to open vector map <%s>"), opt.input->answer);
+
     Vect_set_error_handler_io(&In, &Out);
     
     field = Vect_get_field_number(&In, opt.lfield->answer);
     
     /* Open output segments */
-    Vect_open_new(&Out, opt.output->answer, Vect_is_3d(&In));
+    if (Vect_open_new(&Out, opt.output->answer, Vect_is_3d(&In)) < 0)
+	G_fatal_error(_("Unable to create vector map <%s>"),
+			opt.output->answer);
+
     Vect_copy_head_data(&In, &Out);
     Vect_hist_copy(&In, &Out);
     Vect_hist_command(&Out);

Modified: grass/trunk/vector/v.to.rast/support.c
===================================================================
--- grass/trunk/vector/v.to.rast/support.c	2014-05-03 02:48:38 UTC (rev 60053)
+++ grass/trunk/vector/v.to.rast/support.c	2014-05-03 13:49:33 UTC (rev 60054)
@@ -119,7 +119,8 @@
     Rast_init_colors(&colors);
 
     /* open vector map and database driver */
-    Vect_open_old(&Map, vector_map, "");
+    if (Vect_open_old(&Map, vector_map, "") < 0)
+	G_fatal_error(_("Unable to open vector map <%s>"), vector_map);
 
     db_CatValArray_init(&cvarr);
     if ((Fi = Vect_get_field(&Map, field)) == NULL)
@@ -277,7 +278,8 @@
 
 	    /* open vector map and database driver */
 	    Vect_set_open_level(1);
-	    Vect_open_old(&Map, vector_map, G_find_vector2(vector_map, ""));
+	    if (Vect_open_old(&Map, vector_map, G_find_vector2(vector_map, "")) < 0)
+		G_fatal_error(_("Unable to open vector map <%s>"), vector_map);
 
 	    db_CatValArray_init(&cvarr);
 	    if (!(Fi = Vect_get_field(&Map, field)))
@@ -428,7 +430,9 @@
 
 		/* open vector map and database driver */
 		Vect_set_open_level(1);
-		Vect_open_old(&Map, vector_map, G_find_vector2(vector_map, ""));
+		if (Vect_open_old(&Map, vector_map, G_find_vector2(vector_map, "")) < 0)
+		    G_fatal_error(_("Unable to open vector map <%s>"),
+				    vector_map);
 
 		db_CatValArray_init(&cvarr);
 		if (!(Fi = Vect_get_field(&Map, field)))

Modified: grass/trunk/vector/v.to.rast/vect2rast.c
===================================================================
--- grass/trunk/vector/v.to.rast/vect2rast.c	2014-05-03 02:48:38 UTC (rev 60053)
+++ grass/trunk/vector/v.to.rast/vect2rast.c	2014-05-03 13:49:33 UTC (rev 60054)
@@ -35,7 +35,9 @@
 
     G_verbose_message(_("Loading data..."));
     Vect_set_open_level(2);
-    Vect_open_old2(&Map, vector_map, "", field_name);
+    if (Vect_open_old2(&Map, vector_map, "", field_name) < 0)
+	G_fatal_error(_("Unable to open vector map <%s>"), vector_map);
+
     field = Vect_get_field_number(&Map, field_name);
 
     if (field > 0)

Modified: grass/trunk/vector/v.to.rast3/main.c
===================================================================
--- grass/trunk/vector/v.to.rast3/main.c	2014-05-03 02:48:38 UTC (rev 60053)
+++ grass/trunk/vector/v.to.rast3/main.c	2014-05-03 13:49:33 UTC (rev 60054)
@@ -69,7 +69,9 @@
     Rast3d_get_window(&region);
 
     Vect_set_open_level(2);
-    Vect_open_old2(&Map, in_opt->answer, "", field_opt->answer);
+    if (Vect_open_old2(&Map, in_opt->answer, "", field_opt->answer) < 0)
+	G_fatal_error(_("Unable to open vector map <%s>"), in_opt->answer);
+
     field = Vect_get_field_number(&Map, field_opt->answer);
 
     db_CatValArray_init(&cvarr);

Modified: grass/trunk/vector/v.transform/main.c
===================================================================
--- grass/trunk/vector/v.transform/main.c	2014-05-03 02:48:38 UTC (rev 60053)
+++ grass/trunk/vector/v.transform/main.c	2014-05-03 13:49:33 UTC (rev 60054)
@@ -174,7 +174,8 @@
     Vect_check_input_output_name(vold->answer, vnew->answer, G_FATAL_EXIT);
 
     /* open input vector */
-    Vect_open_old2(&Old, vold->answer, "", field_opt->answer);
+    if (Vect_open_old2(&Old, vold->answer, "", field_opt->answer) < 0)
+	G_fatal_error(_("Unable to open vector map <%s>"), vold->answer);
 
     field = Vect_get_field_number(&Old, field_opt->answer);
     if (field < 1 && columns->answer) {
@@ -241,7 +242,8 @@
 	out3d = WITH_Z;
 
     /* open output vector */
-    Vect_open_new(&New, vnew->answer, out3d);
+    if (Vect_open_new(&New, vnew->answer, out3d) < 0)
+	G_fatal_error(_("Unable to create vector map <%s>"), vnew->answer);
 
     /* copy and set header */
     Vect_copy_head_data(&Old, &New);

Modified: grass/trunk/vector/v.type/main.c
===================================================================
--- grass/trunk/vector/v.type/main.c	2014-05-03 02:48:38 UTC (rev 60053)
+++ grass/trunk/vector/v.type/main.c	2014-05-03 13:49:33 UTC (rev 60054)
@@ -124,7 +124,9 @@
 
     /* open input vector */
     Vect_set_open_level(1);
-    Vect_open_old2(&In, in_opt->answer, "", field_opt->answer);
+    if (Vect_open_old2(&In, in_opt->answer, "", field_opt->answer) < 0)
+	G_fatal_error(_("Unable to open vector map <%s>"), in_opt->answer);
+
     field = Vect_get_field_number(&In, field_opt->answer);
     
     if (0 > Vect_open_new(&Out, out_opt->answer, Vect_is_3d(&In))) {

Modified: grass/trunk/vector/v.univar/main.c
===================================================================
--- grass/trunk/vector/v.univar/main.c	2014-05-03 02:48:38 UTC (rev 60053)
+++ grass/trunk/vector/v.univar/main.c	2014-05-03 13:49:33 UTC (rev 60054)
@@ -151,7 +151,9 @@
 
     /* open input vector */
     Vect_set_open_level(2);
-    Vect_open_old2(&Map, map_opt->answer, "", field_opt->answer);
+    if (Vect_open_old2(&Map, map_opt->answer, "", field_opt->answer) < 0)
+	G_fatal_error(_("Unable to open vector map <%s>"), map_opt->answer);
+
     ofield = Vect_get_field_number(&Map, field_opt->answer);
     
     if ((otype & GV_POINT) && Vect_get_num_primitives(&Map, GV_POINT) == 0) {

Modified: grass/trunk/vector/v.vect.stats/main.c
===================================================================
--- grass/trunk/vector/v.vect.stats/main.c	2014-05-03 02:48:38 UTC (rev 60053)
+++ grass/trunk/vector/v.vect.stats/main.c	2014-05-03 13:49:33 UTC (rev 60054)
@@ -253,7 +253,8 @@
 	G_fatal_error(_("Vector map <%s> not found"), point_opt->answer);
 
     Vect_set_open_level(2);
-    Vect_open_old(&PIn, point_opt->answer, mapset);
+    if (Vect_open_old(&PIn, point_opt->answer, mapset) < 0)
+	G_fatal_error(_("Unable to open vector map <%s>"), point_opt->answer);
 
     /* Open areas vector */
     if ((mapset = G_find_vector2(area_opt->answer, "")) == NULL)
@@ -263,7 +264,8 @@
 		      area_opt->answer);
 
     Vect_set_open_level(2);
-    Vect_open_old(&AIn, area_opt->answer, mapset);
+    if (Vect_open_old(&AIn, area_opt->answer, mapset) < 0)
+	G_fatal_error(_("Unable to open vector map <%s>"), area_opt->answer);
 
     method = -1;
     use_catno = 0;

Modified: grass/trunk/vector/v.vol.rst/main.c
===================================================================
--- grass/trunk/vector/v.vol.rst/main.c	2014-05-03 02:48:38 UTC (rev 60053)
+++ grass/trunk/vector/v.vol.rst/main.c	2014-05-03 13:49:33 UTC (rev 60054)
@@ -559,7 +559,8 @@
     }
 
     Vect_set_open_level(1);
-    Vect_open_old(&In, input, "");
+    if (Vect_open_old(&In, input, "") < 0)
+	G_fatal_error(_("Unable to open vector map <%s>"), input);
 
     if (!Vect_is_3d(&In))
 	G_warning(_("Vector is not 3D"));
@@ -577,10 +578,13 @@
 	Cats = Vect_new_cats_struct();
 	db_init_string(&sql);
 
-	if (devi != NULL)
-	    Vect_open_new(&Map, devi, 1);
-	else
-	    Vect_open_new(&Map, cvdev, 1);
+	if (devi != NULL) {
+	    if (Vect_open_new(&Map, devi, 1) < 0)
+		G_fatal_error(_("Unable to create vector map <%s>"), devi);
+	} else {
+	    if (Vect_open_new(&Map, cvdev, 1) < 0)
+		G_fatal_error(_("Unable to create vector map <%s>"), cvdev);
+	}
 	Vect_hist_command(&Map);
 	f = Vect_default_field_info(&Map, 1, NULL, GV_1TABLE);
 	Vect_map_add_dblink(&Map, 1, NULL, f->table, GV_KEY_COLUMN, f->database,

Modified: grass/trunk/vector/v.voronoi/main.c
===================================================================
--- grass/trunk/vector/v.voronoi/main.c	2014-05-03 02:48:38 UTC (rev 60053)
+++ grass/trunk/vector/v.voronoi/main.c	2014-05-03 13:49:33 UTC (rev 60054)
@@ -191,7 +191,8 @@
 
     /* open files */
     Vect_set_open_level(2);
-    Vect_open_old2(&In, opt.in->answer, "", opt.field->answer);
+    if (Vect_open_old2(&In, opt.in->answer, "", opt.field->answer) < 0)
+	G_fatal_error(_("Unable to open vector map <%s>"), opt.in->answer);
 
     Field = Vect_get_field_number(&In, opt.field->answer);
     
@@ -209,7 +210,8 @@
     else
 	readsites();
 
-    Vect_open_new(&Out, opt.out->answer, 0);
+    if (Vect_open_new(&Out, opt.out->answer, 0) < 0)
+	G_fatal_error(_("Unable to create vector map <%s>"), opt.out->answer);
 
     Vect_hist_copy(&In, &Out);
     Vect_hist_command(&Out);

Modified: grass/trunk/vector/v.what.rast/main.c
===================================================================
--- grass/trunk/vector/v.what.rast/main.c	2014-05-03 02:48:38 UTC (rev 60053)
+++ grass/trunk/vector/v.what.rast/main.c	2014-05-03 13:49:33 UTC (rev 60054)
@@ -124,9 +124,10 @@
 
     /* Open vector */
     Vect_set_open_level(2);
-    Vect_open_old2(&Map, opt.vect->answer,
+    if (Vect_open_old2(&Map, opt.vect->answer,
 		   print_flag->answer ? "" : G_mapset(),
-		   opt.field->answer);
+		   opt.field->answer) < 0)
+	G_fatal_error(_("Unable to open vector map <%s>"), opt.vect->answer);
 
     field = Vect_get_field_number(&Map, opt.field->answer);
 

Modified: grass/trunk/vector/v.what.rast3/main.c
===================================================================
--- grass/trunk/vector/v.what.rast3/main.c	2014-05-03 02:48:38 UTC (rev 60053)
+++ grass/trunk/vector/v.what.rast3/main.c	2014-05-03 13:49:33 UTC (rev 60054)
@@ -109,7 +109,8 @@
 
     /* Open vector */
     Vect_set_open_level(2);
-    Vect_open_old2(&Map, opt.vect->answer, "", opt.field->answer);
+    if (Vect_open_old2(&Map, opt.vect->answer, "", opt.field->answer) < 0)
+	G_fatal_error(_("Unable to open vector map <%s>"), opt.vect->answer);
 
     field = Vect_get_field_number(&Map, opt.field->answer);
 



More information about the grass-commit mailing list