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/cdk/unix2.ml


From: mldonkey-commits
Subject: [Mldonkey-commits] mldonkey distrib/ChangeLog src/utils/cdk/unix2.ml
Date: Sat, 23 Oct 2010 18:18:41 +0000

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

Modified files:
        distrib        : ChangeLog 
        src/utils/cdk  : unix2.ml 

Log message:
        patch #7350

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/mldonkey/distrib/ChangeLog?cvsroot=mldonkey&r1=1.1481&r2=1.1482
http://cvs.savannah.gnu.org/viewcvs/mldonkey/src/utils/cdk/unix2.ml?cvsroot=mldonkey&r1=1.36&r2=1.37

Patches:
Index: distrib/ChangeLog
===================================================================
RCS file: /sources/mldonkey/mldonkey/distrib/ChangeLog,v
retrieving revision 1.1481
retrieving revision 1.1482
diff -u -b -r1.1481 -r1.1482
--- distrib/ChangeLog   19 Oct 2010 17:30:58 -0000      1.1481
+++ distrib/ChangeLog   23 Oct 2010 18:18:41 -0000      1.1482
@@ -14,6 +14,9 @@
 ChangeLog
 =========
 
+2010/10/23
+7350: cleanup accesstest temp files (ygrek)
+
 2010/10/19
 7349: Fix release.* make targets on GNU/kFreeBSD
 7348: Update GNU config.guess and config.sub to version 2010/09

Index: src/utils/cdk/unix2.ml
===================================================================
RCS file: /sources/mldonkey/mldonkey/src/utils/cdk/unix2.ml,v
retrieving revision 1.36
retrieving revision 1.37
diff -u -b -r1.36 -r1.37
--- src/utils/cdk/unix2.ml      16 Jul 2010 13:56:35 -0000      1.36
+++ src/utils/cdk/unix2.ml      23 Oct 2010 18:18:41 -0000      1.37
@@ -41,6 +41,8 @@
   tryopen (open_out_gen flags perm) close_out fn f
 let tryopen_openfile fn flags perm f =
   tryopen (fun fn -> Unix.openfile fn flags perm) Unix.close fn f
+let tryopen_tempfile fn flags perm f =
+  tryopen (fun fn -> Unix.openfile fn flags perm) (fun fd -> Unix.close fd; 
try Sys.remove fn with _ -> ()) fn f
 let tryopen_dir dir f = tryopen opendir closedir dir f
 let tryopen_read_zip fn f = tryopen Zip.open_in Zip.close_in fn f
 let tryopen_write_zip fn f = tryopen Zip.open_out Zip.close_out fn f
@@ -208,13 +210,13 @@
   done;
   s
 
-let rec can_write_to_directory dirname =
+let can_write_to_directory dirname =
   let temp_file = Filename.concat dirname "tmp_" ^ random () ^ "_mld.tmp" in
   let check () =
-    tryopen_openfile temp_file [O_WRONLY; O_CREAT] 0o600 (fun fd ->
+    tryopen_tempfile temp_file [O_WRONLY; O_CREAT] 0o600 (fun fd ->
       let test_string = "mldonkey accesstest - this file can be deleted\n" in
-      really_write fd test_string 0 (String.length test_string));
-    (try Sys.remove temp_file with _ -> ()) in
+      really_write fd test_string 0 (String.length test_string))
+  in
   try
     check ()
   with
@@ -228,8 +230,8 @@
        with _ ->
           lprintf_nl "%s does not exist and can not be created,  exiting..." 
dirname; 
          exit 73)
-    | Unix.Unix_error (error, what, code) -> 
-       lprintf_nl "%s for directory %s" (error_message error) what;
+  | Unix.Unix_error (error, func, what) -> 
+      lprintf_nl "%s(%s) : %s for directory %s" func what (error_message 
error) dirname;
        exit 73
     | e -> 
        lprintf_nl "%s for directory %s" (Printexc2.to_string e) dirname; 



reply via email to

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