[GRASS-SVN] r68415 - grass/trunk/lib/imagery
svn_grass at osgeo.org
svn_grass at osgeo.org
Mon May 9 15:03:05 PDT 2016
Author: mmetz
Date: 2016-05-09 15:03:05 -0700 (Mon, 09 May 2016)
New Revision: 68415
Modified:
grass/trunk/lib/imagery/sigfile.c
grass/trunk/lib/imagery/sigsetfile.c
Log:
imagerylib: do not overwrite signature files without permission
Modified: grass/trunk/lib/imagery/sigfile.c
===================================================================
--- grass/trunk/lib/imagery/sigfile.c 2016-05-09 19:29:11 UTC (rev 68414)
+++ grass/trunk/lib/imagery/sigfile.c 2016-05-09 22:03:05 UTC (rev 68415)
@@ -13,6 +13,8 @@
#include <string.h>
#include <grass/imagery.h>
+#include <grass/gis.h>
+#include <grass/glocale.h>
/*!
\brief Create signature file
@@ -37,6 +39,13 @@
/* create sigset directory */
sprintf(element, "%s/subgroup/%s/sig", group_name, subgroup);
+ if (G_getenv_nofatal("OVERWRITE")) {
+ if (G_find_file_misc("group", element, group_name, G_mapset())) {
+ G_fatal_error(_("Signature file for group '%s', subgroup '%s' exists."
+ " To overwrite, use the --overwrite flag"), group_name, subgroup);
+ return NULL;
+ }
+ }
G__make_mapset_element_misc("group", element);
sprintf(element, "subgroup/%s/sig/%s", subgroup, name);
Modified: grass/trunk/lib/imagery/sigsetfile.c
===================================================================
--- grass/trunk/lib/imagery/sigsetfile.c 2016-05-09 19:29:11 UTC (rev 68414)
+++ grass/trunk/lib/imagery/sigsetfile.c 2016-05-09 22:03:05 UTC (rev 68415)
@@ -15,6 +15,7 @@
#include <grass/gis.h>
#include <grass/imagery.h>
+#include <grass/gis.h>
#include <grass/glocale.h>
/*!
@@ -48,6 +49,13 @@
/* create sigset directory */
sprintf(element, "%s/subgroup/%s/sigset", group_name, subgroup);
+ if (G_getenv_nofatal("OVERWRITE")) {
+ if (G_find_file_misc("group", element, group_name, G_mapset())) {
+ G_fatal_error(_("Signature file for group '%s', subgroup '%s' exists."
+ " To overwrite, use the --overwrite flag"), group_name, subgroup);
+ return NULL;
+ }
+ }
G__make_mapset_element_misc("group", element);
sprintf(element, "subgroup/%s/sigset/%s", subgroup, name);
More information about the grass-commit
mailing list