瀏覽代碼

vlib: fix clean up when creation of new vector map fails (pg)

git-svn-id: https://svn.osgeo.org/grass/grass/trunk@52569 15284696-431f-4ddb-bdfa-cd5b030d7da7
Martin Landa 13 年之前
父節點
當前提交
87e30f072b
共有 2 個文件被更改,包括 4 次插入5 次删除
  1. 1 2
      lib/vector/Vlib/open.c
  2. 3 3
      lib/vector/Vlib/open_pg.c

+ 1 - 2
lib/vector/Vlib/open.c

@@ -776,8 +776,7 @@ int Vect_open_new(struct Map_info *Map, const char *name, int with_z)
     Map->plus.spidx_with_z = Map->plus.with_z = Map->head.with_z = (with_z != 0);
 
     if ((*Open_new_array[Map->format][1]) (Map, name, with_z) < 0) {
-        G_fatal_error(_("Unable to create vector map <%s>"),
-                      name);
+        Vect_delete(name); /* clean up */
         return -1;
     }
 

+ 3 - 3
lib/vector/Vlib/open_pg.c

@@ -271,9 +271,9 @@ int V1_open_new_pg(struct Map_info *Map, const char *name, int with_z)
             }
         }
         else {
-            G_fatal_error(_("PostGIS layer <%s.%s> already exists in database '%s'"),
-                          pg_info->schema_name, pg_info->table_name,
-                          pg_info->db_name);
+            G_warning(_("PostGIS layer <%s.%s> already exists in database '%s'"),
+                      pg_info->schema_name, pg_info->table_name,
+                      pg_info->db_name);
             return -1;
         }
     }