Bladeren bron

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 jaren geleden
bovenliggende
commit
6bc679735b
1 gewijzigde bestanden met toevoegingen van 7 en 1 verwijderingen
  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();
         output_name = D_get_file();
         if (!output_name) 
         if (!output_name) 
             return;
             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 {
     else {
         output_name = output;
         output_name = output;