mldonkey-commits
[Top][All Lists]
Advanced

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

[Mldonkey-commits] mldonkey distrib/ChangeLog src/networks/bittorr...


From: mldonkey-commits
Subject: [Mldonkey-commits] mldonkey distrib/ChangeLog src/networks/bittorr...
Date: Sun, 11 Feb 2007 13:07:48 +0000

CVSROOT:        /sources/mldonkey
Module name:    mldonkey
Changes by:     spiralvoice <spiralvoice>       07/02/11 13:07:48

Modified files:
        distrib        : ChangeLog 
        src/networks/bittorrent: bTInteractive.ml 
        src/utils/cdk  : unix2.ml 
        src/utils/lib  : unix32.ml 

Log message:
        patch #5737

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/mldonkey/distrib/ChangeLog?cvsroot=mldonkey&r1=1.1174&r2=1.1175
http://cvs.savannah.gnu.org/viewcvs/mldonkey/src/networks/bittorrent/bTInteractive.ml?cvsroot=mldonkey&r1=1.127&r2=1.128
http://cvs.savannah.gnu.org/viewcvs/mldonkey/src/utils/cdk/unix2.ml?cvsroot=mldonkey&r1=1.33&r2=1.34
http://cvs.savannah.gnu.org/viewcvs/mldonkey/src/utils/lib/unix32.ml?cvsroot=mldonkey&r1=1.67&r2=1.68

Patches:
Index: distrib/ChangeLog
===================================================================
RCS file: /sources/mldonkey/mldonkey/distrib/ChangeLog,v
retrieving revision 1.1174
retrieving revision 1.1175
diff -u -b -r1.1174 -r1.1175
--- distrib/ChangeLog   6 Feb 2007 22:26:58 -0000       1.1174
+++ distrib/ChangeLog   11 Feb 2007 13:07:47 -0000      1.1175
@@ -14,6 +14,10 @@
 ChangeLog
 =========
 
+2007/02/11
+5737: MinGW: Work-around missing Unix.fstat
+- fixes failed removal of torrent files from torrents/[incoming|downloads]
+
 2007/02/06
 5719: Unix2: Fix copying files > 1GB (1073741823 bytes),
       bug was introduced by patch 5589 after release of 2.8.2

Index: src/networks/bittorrent/bTInteractive.ml
===================================================================
RCS file: /sources/mldonkey/mldonkey/src/networks/bittorrent/bTInteractive.ml,v
retrieving revision 1.127
retrieving revision 1.128
diff -u -b -r1.127 -r1.128
--- src/networks/bittorrent/bTInteractive.ml    4 Feb 2007 17:22:18 -0000       
1.127
+++ src/networks/bittorrent/bTInteractive.ml    11 Feb 2007 13:07:48 -0000      
1.128
@@ -616,9 +616,14 @@
     (if torrent.torrent_announce_list <> [] then torrent.torrent_announce_list 
else [torrent.torrent_announce]);
   if not !torrent_is_usable then raise Torrent_can_not_be_used;
 
-  let torrent_diskname = Filename.concat
-    downloads_directory
-    torrent.torrent_name ^ ".torrent"
+  let torrent_diskname =
+    let fs = Unix32.filesystem downloads_directory in
+    let namemax =
+      match Unix32.fnamelen downloads_directory with
+      | None -> 0
+      | Some v -> Int64.to_int v in
+    Filename.concat downloads_directory
+    (Filename2.filesystem_compliant torrent.torrent_name fs namemax) ^ 
".torrent"
     in
   if Sys.file_exists torrent_diskname then
     begin

Index: src/utils/cdk/unix2.ml
===================================================================
RCS file: /sources/mldonkey/mldonkey/src/utils/cdk/unix2.ml,v
retrieving revision 1.33
retrieving revision 1.34
diff -u -b -r1.33 -r1.34
--- src/utils/cdk/unix2.ml      6 Feb 2007 22:26:59 -0000       1.33
+++ src/utils/cdk/unix2.ml      11 Feb 2007 13:07:48 -0000      1.34
@@ -136,13 +136,18 @@
 
 let copy oldname newname =
   tryopen_read_bin oldname (fun ic ->
-    let stats = Unix.LargeFile.fstat (Unix.descr_of_in_channel ic) in
+    let stats =
+      try Some (Unix.LargeFile.fstat (Unix.descr_of_in_channel ic)) with _ -> 
None
+    in
     tryopen_write_bin newname (fun oc ->
+      (match stats with
+      | None -> ()
+      | Some stats ->
       let descr = Unix.descr_of_out_channel oc in
       (try Unix.fchown descr stats.Unix.LargeFile.st_uid 
stats.Unix.LargeFile.st_gid 
        with e -> lprintf_nl "copy: failed to preserve owner");
       (try Unix.fchmod descr stats.Unix.LargeFile.st_perm 
-       with e -> lprintf_nl "copy: failed to preserve mode");
+       with e -> lprintf_nl "copy: failed to preserve mode"));
       let buffer_len = 8192 in
       let buffer = String.create buffer_len in
       let rec copy_file () =

Index: src/utils/lib/unix32.ml
===================================================================
RCS file: /sources/mldonkey/mldonkey/src/utils/lib/unix32.ml,v
retrieving revision 1.67
retrieving revision 1.68
diff -u -b -r1.67 -r1.68
--- src/utils/lib/unix32.ml     6 Feb 2007 22:26:59 -0000       1.67
+++ src/utils/lib/unix32.ml     11 Feb 2007 13:07:48 -0000      1.68
@@ -204,16 +204,24 @@
       raise e
 
     let owner t =
+      let module U = Unix.LargeFile in
       try
       check_destroyed t;
-      let s = Unix.LargeFile.fstat (local_force_fd t) in
-      let user = Unix.getpwuid s.Unix.LargeFile.st_uid in
-      let group = Unix.getgrgid s.Unix.LargeFile.st_gid in
+      let s =
+        try
+          U.fstat (local_force_fd t)
+        with
+ (* Unix.fstat is not supported on MinGW, Unix.stat is supported *)
+        | Invalid_argument _ -> U.stat t.filename
+      in
+      let user = Unix.getpwuid s.U.st_uid in
+      let group = Unix.getgrgid s.U.st_gid in
       user.Unix.pw_name, group.Unix.gr_name
-      with e ->
-      if !verbose then lprintf_nl "Exception in FDCache.owner %s: %s"
-        t.filename
-        (Printexc2.to_string e);
+      with
+      | Not_found -> "", ""
+      | e -> if !verbose then
+            lprintf_nl "Exception in FDCache.owner %s: %s"
+              t.filename (Printexc2.to_string e);
       raise e
 
     let mtime64 t =
@@ -1435,13 +1443,15 @@
   | Destroyed -> "", ""
 
 let owner s =
-  try
     let old_fd_exists = fd_exists s in
     let fd = create_ro s in
-    let user,group = owner_fd fd in
-    if not old_fd_exists then close fd;
-    user,group
+  let user,pass =
+    try
+      owner_fd fd
   with _ -> "", ""
+  in
+  if not old_fd_exists then close fd;
+  user, pass
 
 let rename t f =
   flush_fd t;




reply via email to

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