[GRASS-SVN] r67125 - grass/trunk/raster/r.in.lidar

svn_grass at osgeo.org svn_grass at osgeo.org
Mon Dec 14 12:40:33 PST 2015


Author: wenzeslaus
Date: 2015-12-14 12:40:33 -0800 (Mon, 14 Dec 2015)
New Revision: 67125

Modified:
   grass/trunk/raster/r.in.lidar/string_list.c
Log:
r.in.lidar: check if the file is open

This is already (supposed to be) checked by the caller.
This fixes Coverity CID 1341833.


Modified: grass/trunk/raster/r.in.lidar/string_list.c
===================================================================
--- grass/trunk/raster/r.in.lidar/string_list.c	2015-12-14 20:24:58 UTC (rev 67124)
+++ grass/trunk/raster/r.in.lidar/string_list.c	2015-12-14 20:40:33 UTC (rev 67125)
@@ -3,6 +3,7 @@
 #include <string.h>
 
 #include <grass/gis.h>
+#include <grass/glocale.h>
 
 #include "local_proto.h"
 
@@ -29,6 +30,8 @@
     string_list->max_items = 0;
     string_list->items = NULL;
     FILE *file = fopen(filename, "r");  /* should check the result */
+    if (!file)
+        G_fatal_error(_("Cannot open file %s for reading"), filename);
     char *line = G_malloc(GPATH_MAX * sizeof(char));
 
     while (G_getl2(line, GPATH_MAX * sizeof(char), file)) {



More information about the grass-commit mailing list