[GRASS-SVN] r72649 - grass/trunk/imagery/i.maxlik
svn_grass at osgeo.org
svn_grass at osgeo.org
Thu Apr 26 03:20:18 PDT 2018
Author: marisn
Date: 2018-04-26 03:20:18 -0700 (Thu, 26 Apr 2018)
New Revision: 72649
Modified:
grass/trunk/imagery/i.maxlik/global.h
grass/trunk/imagery/i.maxlik/main.c
Log:
i.maxlik: Correctly handle fully qualified output raster map names.
Modified: grass/trunk/imagery/i.maxlik/global.h
===================================================================
--- grass/trunk/imagery/i.maxlik/global.h 2018-04-26 07:27:47 UTC (rev 72648)
+++ grass/trunk/imagery/i.maxlik/global.h 2018-04-26 10:20:18 UTC (rev 72649)
@@ -9,6 +9,7 @@
extern int *cellfd;
extern CELL *class_cell, *reject_cell;
extern int class_fd, reject_fd;
-extern char *class_name, *reject_name;
+extern char *reject_name;
+extern char class_name[GNAME_MAX];
extern double *B;
extern double *P;
Modified: grass/trunk/imagery/i.maxlik/main.c
===================================================================
--- grass/trunk/imagery/i.maxlik/main.c 2018-04-26 07:27:47 UTC (rev 72648)
+++ grass/trunk/imagery/i.maxlik/main.c 2018-04-26 10:20:18 UTC (rev 72649)
@@ -35,7 +35,8 @@
int *cellfd;
CELL *class_cell, *reject_cell;
int class_fd, reject_fd;
-char *class_name, *reject_name;
+char *reject_name;
+char class_name[GNAME_MAX];
double *B;
double *P;
CELL cat;
@@ -54,6 +55,7 @@
{
struct Option *group, *subgroup, *sigfile, *class, *reject;
} parm;
+ char xmapset[GMAPSET_MAX];
G_gisinit(argv[0]);
@@ -95,11 +97,16 @@
exit(EXIT_FAILURE);
- class_name = parm.class->answer;
reject_name = parm.reject->answer;
group = parm.group->answer;
subgroup = parm.subgroup->answer;
sigfile = parm.sigfile->answer;
+
+ if (G_unqualified_name(parm.class->answer, G_mapset(), class_name, xmapset) < 0)
+ G_fatal_error(_("<%s> does not match the current mapset"), xmapset);
+
+ if (G_legal_filename(class_name) < 0)
+ G_fatal_error(_("<%s> is an illegal file name"), class_name);
open_files();
More information about the grass-commit
mailing list