浏览代码

d.mon: fix https://trac.osgeo.org/grass/ticket/2509 (d.mon output overwrite)

git-svn-id: https://svn.osgeo.org/grass/grass/trunk@63466 15284696-431f-4ddb-bdfa-cd5b030d7da7
Martin Landa 10 年之前
父节点
当前提交
6bc679735b
共有 1 个文件被更改,包括 7 次插入1 次删除
  1. 7 1
      display/d.mon/start.c

+ 7 - 1
display/d.mon/start.c

@@ -24,7 +24,13 @@ void start(const char *name, const char *output)
         output_name = D_get_file();
         if (!output_name) 
             return;
-        D_close_driver();
+        if (!G_get_overwrite() && access(output_name, F_OK) == 0) {
+            D_close_driver();
+            G_fatal_error(_("option <%s>: <%s> exists."),
+                          "output", output_name);
+        }
+        D_close_driver(); /* must be called after check because this
+                           * function produces default map file */
     }
     else {
         output_name = output;