[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Mldonkey-commits] mldonkey distrib/ChangeLog src/networks/direct_...
From: |
mldonkey-commits |
Subject: |
[Mldonkey-commits] mldonkey distrib/ChangeLog src/networks/direct_... |
Date: |
Sat, 23 Oct 2010 18:21:14 +0000 |
CVSROOT: /sources/mldonkey
Module name: mldonkey
Changes by: spiralvoice <spiralvoice> 10/10/23 18:21:13
Modified files:
distrib : ChangeLog
src/networks/direct_connect: dcInteractive.ml
src/utils/cdk : unix2.ml
Log message:
patch #7354
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/mldonkey/distrib/ChangeLog?cvsroot=mldonkey&r1=1.1485&r2=1.1486
http://cvs.savannah.gnu.org/viewcvs/mldonkey/src/networks/direct_connect/dcInteractive.ml?cvsroot=mldonkey&r1=1.40&r2=1.41
http://cvs.savannah.gnu.org/viewcvs/mldonkey/src/utils/cdk/unix2.ml?cvsroot=mldonkey&r1=1.37&r2=1.38
Patches:
Index: distrib/ChangeLog
===================================================================
RCS file: /sources/mldonkey/mldonkey/distrib/ChangeLog,v
retrieving revision 1.1485
retrieving revision 1.1486
diff -u -b -r1.1485 -r1.1486
--- distrib/ChangeLog 23 Oct 2010 18:20:30 -0000 1.1485
+++ distrib/ChangeLog 23 Oct 2010 18:21:12 -0000 1.1486
@@ -15,6 +15,7 @@
=========
2010/10/23
+7354: DC: cleanup temporary files (ygrek)
7353: DC: silence "ADC not supported" message (ygrek)
7352: net: do not log ordinary network errors (ygrek)
7351: DC: fix download of large files (integer overflow) (ygrek)
Index: src/networks/direct_connect/dcInteractive.ml
===================================================================
RCS file:
/sources/mldonkey/mldonkey/src/networks/direct_connect/dcInteractive.ml,v
retrieving revision 1.40
retrieving revision 1.41
diff -u -b -r1.40 -r1.41
--- src/networks/direct_connect/dcInteractive.ml 8 Sep 2010 16:31:50
-0000 1.40
+++ src/networks/direct_connect/dcInteractive.ml 23 Oct 2010 18:21:13
-0000 1.41
@@ -1587,14 +1587,15 @@
try
dc_hublist := (
match List.rev (String2.split filename '.') with
- | "bz2"::"xml"::_ -> DcServers.make_hublist_from_xml
(Xml.parse_file (Misc2.bz2_extract filename))
+ | "bz2"::"xml"::_ ->
+ Unix2.with_remove (Misc2.bz2_extract filename) (fun filename ->
+ DcServers.make_hublist_from_xml (Xml.parse_file filename))
| "xml"::_ -> DcServers.make_hublist_from_xml (Xml.parse_file
filename)
- | "bz2"::_ -> DcServers.make_hublist_from_file
(Misc2.bz2_extract filename)
+ | "bz2"::_ -> Unix2.with_remove (Misc2.bz2_extract filename)
DcServers.make_hublist_from_file
| _ -> DcServers.make_hublist_from_file filename);
- lprintf_nl "loaded dc++ hublist, %d entries" (List.length
!dc_hublist)
+ lprintf_nl "Loaded DC hublist, %d entries" (List.length
!dc_hublist)
with e ->
- if !verbose_msg_servers then
- lprintf_nl "(%s) in loading/parsing serverlist"
(Printexc2.to_string e);
+ lprintf_nl "Exception while parsing hublist from %S : %s" url
(Printexc2.to_string e);
raise Not_found
end
else
Index: src/utils/cdk/unix2.ml
===================================================================
RCS file: /sources/mldonkey/mldonkey/src/utils/cdk/unix2.ml,v
retrieving revision 1.37
retrieving revision 1.38
diff -u -b -r1.37 -r1.38
--- src/utils/cdk/unix2.ml 23 Oct 2010 18:18:41 -0000 1.37
+++ src/utils/cdk/unix2.ml 23 Oct 2010 18:21:13 -0000 1.38
@@ -31,6 +31,9 @@
closef descr;
result
+let exn_drop f x = try f x with _ -> ()
+let with_remove fn f = tryopen (fun fn -> fn) (fun fn -> exn_drop Sys.remove
fn) fn f
+
let tryopen_read fn f = tryopen open_in close_in fn f
let tryopen_write fn f = tryopen open_out close_out fn f
let tryopen_read_bin fn f = tryopen open_in_bin close_in fn f
@@ -41,8 +44,6 @@
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
@@ -212,10 +213,10 @@
let can_write_to_directory dirname =
let temp_file = Filename.concat dirname "tmp_" ^ random () ^ "_mld.tmp" in
- let check () =
- tryopen_tempfile temp_file [O_WRONLY; O_CREAT] 0o600 (fun fd ->
+ let check () = with_remove temp_file (fun _ ->
+ tryopen_openfile 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))
+ really_write fd test_string 0 (String.length test_string)))
in
try
check ()