[GRASS-SVN] r69001 - grass/branches/releasebranch_7_2/display/d.mon
svn_grass at osgeo.org
svn_grass at osgeo.org
Mon Jul 18 07:05:15 PDT 2016
Author: martinl
Date: 2016-07-18 07:05:15 -0700 (Mon, 18 Jul 2016)
New Revision: 69001
Modified:
grass/branches/releasebranch_7_2/display/d.mon/start.c
Log:
d.mon: check for write permission if output is defined
(merge r68983 from trunk)
Modified: grass/branches/releasebranch_7_2/display/d.mon/start.c
===================================================================
--- grass/branches/releasebranch_7_2/display/d.mon/start.c 2016-07-18 14:01:45 UTC (rev 69000)
+++ grass/branches/releasebranch_7_2/display/d.mon/start.c 2016-07-18 14:05:15 UTC (rev 69001)
@@ -1,6 +1,7 @@
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
+#include <libgen.h>
#include <grass/gis.h>
#include <grass/spawn.h>
#include <grass/display.h>
@@ -57,7 +58,18 @@
putenv("GRASS_RENDER_IMMEDIATE=");
}
else {
+ char *dir_name;
+
output_name = output;
+ /* check write permission */
+ dir_name = G_store(output_name);
+ dirname(dir_name);
+ if (access(dir_name, W_OK) != 0)
+ G_fatal_error(_("Unable to start monitor, don't have "
+ "write permission for <%s>"), output_name);
+ G_free(dir_name);
+
+ /* check if file exists */
if (!update && access(output_name, F_OK) == 0) {
if (G_get_overwrite()) {
G_warning(_("File <%s> already exists and will be overwritten"), output_name);
More information about the grass-commit
mailing list