瀏覽代碼

r.in.gdal: warning if there are subdatasets, fix segfault

git-svn-id: https://svn.osgeo.org/grass/grass/trunk@71567 15284696-431f-4ddb-bdfa-cd5b030d7da7
Markus Metz 7 年之前
父節點
當前提交
d1b5a608e8
共有 2 個文件被更改,包括 15 次插入0 次删除
  1. 14 0
      raster/r.in.gdal/main.c
  2. 1 0
      raster/r.in.gdal/proj.c

+ 14 - 0
raster/r.in.gdal/main.c

@@ -371,6 +371,20 @@ int main(int argc, char *argv[])
 		    "(%s or %s)."), "i.rectify -t", "gdalwarp -tps");
     }
 
+    /* does the driver support subdatasets? */
+    /* test for capability GDAL_DMD_SUBDATASETS */
+    
+    /* does the dataset include subdatasets? */
+    {
+	char **sds = GDALGetMetadata(hDS, "SUBDATASETS");
+
+	if (sds && *sds) {
+	    G_warning(_("Input contains subdatasets which may need to "
+	                "be imported separately"));
+	    /* list subdatasets? */
+	}
+    }
+
     if (flag_p->answer) {
         /* print number of bands */
         fprintf(stdout, "%d\n", GDALGetRasterCount(hDS));

+ 1 - 0
raster/r.in.gdal/proj.c

@@ -240,6 +240,7 @@ void check_projection(struct Cell_head *cellhd, GDALDatasetH hDS,
 		msg_fn = G_fatal_error;
 	    msg_fn(error_msg);
 	    if (check_only) {
+		GDALClose(hDS);
 		exit(EXIT_FAILURE);
 	    }
 	}