[GRASS-SVN] r67591 - grass/trunk/vector/v.in.ogr

svn_grass at osgeo.org svn_grass at osgeo.org
Sat Jan 16 01:35:52 PST 2016


Author: martinl
Date: 2016-01-16 01:35:52 -0800 (Sat, 16 Jan 2016)
New Revision: 67591

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


Modified: grass/trunk/vector/v.in.ogr/main.c
===================================================================
--- grass/trunk/vector/v.in.ogr/main.c	2016-01-15 11:15:46 UTC (rev 67590)
+++ grass/trunk/vector/v.in.ogr/main.c	2016-01-16 09:35:52 UTC (rev 67591)
@@ -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
@@ -1672,19 +1672,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