[GRASS-SVN] r69226 - grass/branches/releasebranch_7_0/vector/v.in.ogr

svn_grass at osgeo.org svn_grass at osgeo.org
Tue Aug 23 03:54:58 PDT 2016


Author: martinl
Date: 2016-08-23 03:54:58 -0700 (Tue, 23 Aug 2016)
New Revision: 69226

Modified:
   grass/branches/releasebranch_7_0/vector/v.in.ogr/main.c
Log:
 v.in.ogr Segmentation fault (fix #2868) - patch by mlennert

Modified: grass/branches/releasebranch_7_0/vector/v.in.ogr/main.c
===================================================================
--- grass/branches/releasebranch_7_0/vector/v.in.ogr/main.c	2016-08-23 09:28:38 UTC (rev 69225)
+++ grass/branches/releasebranch_7_0/vector/v.in.ogr/main.c	2016-08-23 10:54:58 UTC (rev 69226)
@@ -9,7 +9,7 @@
  *
  * PURPOSE:      Import OGR vectors
  *
- * COPYRIGHT:    (C) 2003-2015 by the GRASS Development Team
+ * COPYRIGHT:    (C) 2003-2016 by the GRASS Development Team
  *
  *               This program is free software under the GNU General
  *               Public License (>=v2).  Read the file COPYING that
@@ -1699,19 +1699,23 @@
         G_fatal_error(_("Import failed"));
 
     /* create index - may fail on non-unique categories */
-    if (db_create_index2(driver, Fi->table, key_column) != DB_OK)
-        G_warning(_("Unable to create index for table <%s>, key <%s>"),
-                  Fi->table, key_column);
+    if (!flag.notab->answer) {
+    	if (db_create_index2(driver, Fi->table, key_column) != DB_OK)
+        	G_warning(_("Unable to create index for table <%s>, key <%s>"),
+                	  Fi->table, key_column);
     
-    if (delete_table) {
-        sprintf(buf, "drop table %s", Fi->table);
-        db_set_string(&sql, buf);
-        if (db_execute_immediate(driver, &sql) != DB_OK) {
-            G_fatal_error(_("Unable to drop table: '%s'"),
-                          db_get_string(&sql));
-        }
+    
+	if (delete_table) {
+        	sprintf(buf, "drop table %s", Fi->table);
+	        db_set_string(&sql, buf);
+        	if (db_execute_immediate(driver, &sql) != DB_OK) {
+	            G_fatal_error(_("Unable to drop table: '%s'"),
+        	                  db_get_string(&sql));
+        	}
+    	}
+
+	db_close_database_shutdown_driver(driver);
     }
-    db_close_database_shutdown_driver(driver);
     
     /* -------------------------------------------------------------------- */
     /*      Extend current window based on dataset.                         */



More information about the grass-commit mailing list