mldonkey-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Mldonkey-commits] mldonkey distrib/ChangeLog src/utils/lib/option...


From: mldonkey-commits
Subject: [Mldonkey-commits] mldonkey distrib/ChangeLog src/utils/lib/option...
Date: Sat, 23 Oct 2010 18:22:30 +0000

CVSROOT:        /sources/mldonkey
Module name:    mldonkey
Changes by:     spiralvoice <spiralvoice>       10/10/23 18:22:30

Modified files:
        distrib        : ChangeLog 
        src/utils/lib  : options.ml4 

Log message:
        patch #7356

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/mldonkey/distrib/ChangeLog?cvsroot=mldonkey&r1=1.1487&r2=1.1488
http://cvs.savannah.gnu.org/viewcvs/mldonkey/src/utils/lib/options.ml4?cvsroot=mldonkey&r1=1.31&r2=1.32

Patches:
Index: distrib/ChangeLog
===================================================================
RCS file: /sources/mldonkey/mldonkey/distrib/ChangeLog,v
retrieving revision 1.1487
retrieving revision 1.1488
diff -u -b -r1.1487 -r1.1488
--- distrib/ChangeLog   23 Oct 2010 18:21:55 -0000      1.1487
+++ distrib/ChangeLog   23 Oct 2010 18:22:29 -0000      1.1488
@@ -15,6 +15,7 @@
 =========
 
 2010/10/23
+7356: options: ensure that tmp file is removed (ygrek)
 7355: DC web ui: escape commands' arguments (ygrek)
 7354: DC: cleanup temporary files (ygrek)
 7353: DC: silence "ADC not supported" message (ygrek)

Index: src/utils/lib/options.ml4
===================================================================
RCS file: /sources/mldonkey/mldonkey/src/utils/lib/options.ml4,v
retrieving revision 1.31
retrieving revision 1.32
diff -u -b -r1.31 -r1.32
--- src/utils/lib/options.ml4   29 Aug 2010 20:17:57 -0000      1.31
+++ src/utils/lib/options.ml4   23 Oct 2010 18:22:29 -0000      1.32
@@ -851,10 +851,10 @@
   if not (Sys.file_exists old_config_dir) then Unix.mkdir old_config_dir 0o755;
 
   let filename = opfile.file_name in
-  let temp_file = filename ^ ".tmp" in
   let old_file = Filename.concat old_config_dir filename in
 
   try
+    Unix2.with_remove (filename ^ ".tmp") begin fun temp_file ->
     Unix2.tryopen_write temp_file (fun oc ->
       (* race! *)
       if !save_private then (try Unix.chmod temp_file 0o600 with _ -> ());
@@ -951,6 +951,7 @@
      with e ->
         lprintf_nl "[Opt] exception %s while saving %s" (Printexc2.to_string 
e) filename
     );
+    end; (* remove temp_file *)
     opfile.file_after_save_hook ();
   with e -> 
     opfile.file_after_save_hook ();



reply via email to

[Prev in Thread] Current Thread [Next in Thread]