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/unix32.ml


From: mldonkey-commits
Subject: [Mldonkey-commits] mldonkey distrib/ChangeLog src/utils/lib/unix32.ml
Date: Thu, 13 Apr 2006 23:55:25 +0000

CVSROOT:        /sources/mldonkey
Module name:    mldonkey
Branch:         
Changes by:     spiralvoice <address@hidden>    06/04/13 23:55:25

Modified files:
        distrib        : ChangeLog 
        src/utils/lib  : unix32.ml 

Log message:
        patch #5036

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/mldonkey/mldonkey/distrib/ChangeLog.diff?tr1=1.800&tr2=1.801&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/mldonkey/mldonkey/src/utils/lib/unix32.ml.diff?tr1=1.60&tr2=1.61&r1=text&r2=text

Patches:
Index: mldonkey/distrib/ChangeLog
diff -u mldonkey/distrib/ChangeLog:1.800 mldonkey/distrib/ChangeLog:1.801
--- mldonkey/distrib/ChangeLog:1.800    Thu Apr 13 23:53:57 2006
+++ mldonkey/distrib/ChangeLog  Thu Apr 13 23:55:25 2006
@@ -15,6 +15,7 @@
 =========
 
 2006/04/10
+5036: BT: Correctly parse .torrent files with an empty directory (again)
 5039: Fix dp500 compile
 -------------------------------------------------------------------------------
 2006/04/13: version 2.7.5 = tag release-2-7-5
Index: mldonkey/src/utils/lib/unix32.ml
diff -u mldonkey/src/utils/lib/unix32.ml:1.60 
mldonkey/src/utils/lib/unix32.ml:1.61
--- mldonkey/src/utils/lib/unix32.ml:1.60       Mon Mar  6 18:02:16 2006
+++ mldonkey/src/utils/lib/unix32.ml    Thu Apr 13 23:55:25 2006
@@ -150,8 +150,13 @@
          destroyed = false;
         }
       in
+      try
       let _fd = _local_force_fd true t in
       t
+      with
+       Unix.Unix_error (Unix.EISDIR, _, _) -> t
+      | Unix.Unix_error (Unix.EACCES, _, _) when Autoconf.windows -> t
+      | e -> raise e
       
     let local_force_fd t = _local_force_fd false t
 
@@ -173,23 +178,6 @@
         (Printexc2.to_string e);
       raise e
 
-    let multi_rename t f file =
-      try
-      check_destroyed t;
-      close t;
-      (let d = (Filename.dirname (Filename.concat f file)) in
-        Unix2.safe_mkdir d;
-        Unix2.chmod d (Misc.int_of_octal_string !create_dir_mask);
-       Unix2.can_write_to_directory d);
-      Unix2.rename t.filename (Filename.concat f file);
-      destroy t
-      with e ->
-      if !verbose then lprintf_nl "Exception in FDCache.multi_rename %s %s: %s"
-        t.filename
-        (Filename.concat f file)
-        (Printexc2.to_string e);
-      raise e
-
     let ftruncate64 t len sparse =
       try
       check_destroyed t;
@@ -206,7 +194,10 @@
       try
       check_destroyed t;
       Unix2.c_getfdsize64 (local_force_fd t)
-      with e ->
+      with
+       Unix.Unix_error (Unix.EISDIR, _, _) -> 0L
+      | Unix.Unix_error (Unix.EACCES, _, _) when Autoconf.windows -> 0L
+      | e ->
       if !verbose then lprintf_nl "Exception in FDCache.getsize64 %s: %s"
         t.filename
         (Printexc2.to_string e);
@@ -258,6 +249,28 @@
         (Printexc2.to_string e);
       raise e
 
+    let multi_rename t f file =
+      try
+      check_destroyed t;
+      close t;
+      (let d = (Filename.dirname (Filename.concat f file)) in
+        Unix2.safe_mkdir d;
+        Unix2.chmod d (Misc.int_of_octal_string !create_dir_mask);
+       Unix2.can_write_to_directory d);
+      (try
+        Unix2.rename t.filename (Filename.concat f file);
+      with
+        Unix.Unix_error (Unix.EACCES, _, _) when
+          Autoconf.windows && (Unix2.list_directory t.filename = [])
+        -> remove t);
+      destroy t
+      with e ->
+      lprintf_nl "Exception in FDCache.multi_rename %s %s: %s"
+        t.filename
+        (Filename.concat f file)
+        (Printexc2.to_string e);
+      raise e
+
     let read file file_pos string string_pos len =
       try
       let fd = local_force_fd file in
@@ -461,18 +474,12 @@
             let temp_filename = Filename.concat dirname filename in
             Unix2.safe_mkdir (Filename.dirname temp_filename);
             let fd = FDCache.create temp_filename writable in
-            let cur_len = 
-             if Unix2.is_directory temp_filename then 0L
-             else begin
-               ignore(FDCache.local_force_fd fd);
-               FDCache.getsize64 fd
-             end in
             iter tail (pos ++ size)
             ({
                 filename = filename;
                 pos = pos;
                 len = size;
-                current_len = cur_len;
+                current_len = FDCache.getsize64 fd;
                 fd = fd;
                 tail = [];
               } :: files2)




reply via email to

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