mldonkey-commits
[Top][All Lists]
Advanced

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

[Mldonkey-commits] mldonkey/src networks/donkey/donkeyGlobals.ml u...


From: mldonkey-commits
Subject: [Mldonkey-commits] mldonkey/src networks/donkey/donkeyGlobals.ml u...
Date: Thu, 19 Jan 2006 01:53:54 +0000

CVSROOT:        /sources/mldonkey
Module name:    mldonkey
Branch:         
Changes by:     spiralvoice <address@hidden>    06/01/19 01:53:54

Modified files:
        src/networks/donkey: donkeyGlobals.ml 
        src/utils/lib  : unix32.ml 

Log message:
        patch #4811

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/mldonkey/mldonkey/src/networks/donkey/donkeyGlobals.ml.diff?tr1=1.72&tr2=1.73&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/mldonkey/mldonkey/src/utils/lib/unix32.ml.diff?tr1=1.54&tr2=1.55&r1=text&r2=text

Patches:
Index: mldonkey/src/networks/donkey/donkeyGlobals.ml
diff -u mldonkey/src/networks/donkey/donkeyGlobals.ml:1.72 
mldonkey/src/networks/donkey/donkeyGlobals.ml:1.73
--- mldonkey/src/networks/donkey/donkeyGlobals.ml:1.72  Mon Jan 16 16:05:14 2006
+++ mldonkey/src/networks/donkey/donkeyGlobals.ml       Thu Jan 19 01:53:54 2006
@@ -325,7 +325,7 @@
   with _ ->
       if !verbose_share then
         lprintf_nl () "New file with md4: %s" (Md4.to_string md4);
-      let _ = Unix32.file_exists file_diskname in
+      ignore (Unix32.file_exists file_diskname);
 
       let t =
         if
@@ -350,7 +350,19 @@
       in
 
       if file_size <> zero && writable then (* do not truncate if not writable 
*)
-        Unix32.ftruncate64 t file_size !!create_file_sparse;
+        begin
+         try
+            Unix32.ftruncate64 t file_size !!create_file_sparse
+         with e ->
+           (try
+             Unix32.remove t
+            with e ->
+               lprintf_nl () "Unix32.remove %s exception %s"
+                 (file_diskname) (Printexc2.to_string e));
+           Unix32.destroy t;
+           failwith (Printf.sprintf "file size %s is too big, exception: %s"
+             (size_of_int64 file_size) (Printexc2.to_string e))
+       end;
 
       let nchunks = Int64.to_int (Int64.pred file_size // block_size) + 1 in
       let md4s = if file_size <= block_size then
Index: mldonkey/src/utils/lib/unix32.ml
diff -u mldonkey/src/utils/lib/unix32.ml:1.54 
mldonkey/src/utils/lib/unix32.ml:1.55
--- mldonkey/src/utils/lib/unix32.ml:1.54       Mon Jan  9 00:25:59 2006
+++ mldonkey/src/utils/lib/unix32.ml    Thu Jan 19 01:53:54 2006
@@ -130,7 +130,7 @@
                  else
                    Unix.openfile t.filename ro_flag 0o400
                with e ->
-                 lprintf_nl "Exception in FDCache._local_force_fd %s (%s): %s" 
+                 if !verbose then lprintf_nl "Exception in 
FDCache._local_force_fd %s (%s): %s" 
                    t.filename 
                    (if t.writable then "rw" else "ro") 
                     (Printexc2.to_string e);
@@ -172,7 +172,7 @@
       Unix2.rename t.filename f;
       destroy t
       with e ->
-      lprintf_nl "Exception in FDCache.rename %s %s: %s"
+      if !verbose then lprintf_nl "Exception in FDCache.rename %s %s: %s"
         t.filename
         f
         (Printexc2.to_string e);
@@ -189,7 +189,7 @@
       Unix2.rename t.filename (Filename.concat f file);
       destroy t
       with e ->
-      lprintf_nl "Exception in FDCache.multi_rename %s %s: %s"
+      if !verbose then lprintf_nl "Exception in FDCache.multi_rename %s %s: %s"
         t.filename
         (Filename.concat f file)
         (Printexc2.to_string e);
@@ -200,7 +200,7 @@
       check_destroyed t;
       Unix2.c_ftruncate64 (local_force_fd t) len sparse
       with e ->
-      lprintf_nl "Exception in FDCache.ftruncate64 %s %Ld (%s): %s"
+      if !verbose then lprintf_nl "Exception in FDCache.ftruncate64 %s %Ld 
(%s): %s"
         t.filename
         len
         (if sparse then "sparse" else "not sparse")
@@ -216,7 +216,7 @@
         close t;
       s
       with e ->
-      lprintf_nl "Exception in FDCache.getsize64 %s: %s"
+      if !verbose then lprintf_nl "Exception in FDCache.getsize64 %s: %s"
         t.filename
         (Printexc2.to_string e);
       raise e
@@ -227,7 +227,7 @@
       let st = Unix.LargeFile.stat t.filename in
       st.Unix.LargeFile.st_mtime
       with e ->
-      lprintf_nl "Exception in FDCache.mtime64 %s: %s"
+      if !verbose then lprintf_nl "Exception in FDCache.mtime64 %s: %s"
         t.filename
         (Printexc2.to_string e);
       raise e
@@ -237,7 +237,7 @@
       check_destroyed t;
       Sys.file_exists t.filename
       with e ->
-      lprintf_nl "Exception in FDCache.exists %s: %s"
+      if !verbose then lprintf_nl "Exception in FDCache.exists %s: %s"
         t.filename
         (Printexc2.to_string e);
       raise e
@@ -249,7 +249,7 @@
         Sys.remove t.filename;
       destroy t
       with e ->
-      lprintf_nl "Exception in FDCache.remove %s: %s"
+      if !verbose then lprintf_nl "Exception in FDCache.remove %s: %s"
         t.filename
         (Printexc2.to_string e);
       raise e
@@ -265,7 +265,7 @@
           len;
       Unix2.really_read fd string string_pos len
       with e ->
-      lprintf_nl "Exception in FDCache.read %s %Ld %d: %s"
+      if !verbose then lprintf_nl "Exception in FDCache.read %s %Ld %d: %s"
         file.filename
         file_pos
         len
@@ -284,7 +284,7 @@
           len;
           really_write fd string string_pos len
       with e ->
-      lprintf_nl "Exception in FDCache.write file %s file_pos=%Ld len=%d 
string_pos=%d, string length=%d: %s"
+      if !verbose then lprintf_nl "Exception in FDCache.write file %s 
file_pos=%Ld len=%d string_pos=%d, string length=%d: %s"
         file.filename
         file_pos
         len
@@ -311,7 +311,7 @@
       try
        iter len64 pos1 pos2
       with e ->
-       lprintf_nl "Exception in FDCache.copy_chunk %s %Ld to %s %Ld (%Ld): %s"
+       if !verbose then lprintf_nl "Exception in FDCache.copy_chunk %s %Ld to 
%s %Ld (%Ld): %s"
          t1.filename 
          pos1
          t2.filename
@@ -546,7 +546,7 @@
           Sys.remove temp_file;
           v
        with e ->
-         lprintf_nl "Exception in MultiFile.apply_on_chunk %s %Ld %Ld: %s"
+         if !verbose then lprintf_nl "Exception in MultiFile.apply_on_chunk %s 
%Ld %Ld: %s"
            t.dirname
            chunk_begin
            chunk_len
@@ -576,7 +576,7 @@
        let st = Unix.LargeFile.stat t.dirname in
        st.Unix.LargeFile.st_mtime
       with e ->
-       lprintf_nl "Exception in MultiFile.mtime64 %s: %s" 
+       if !verbose then lprintf_nl "Exception in MultiFile.mtime64 %s: %s" 
          t.dirname
           (Printexc2.to_string e);
        raise e
@@ -590,7 +590,7 @@
        if Sys.file_exists t.dirname then
           Unix2.remove_all_directory t.dirname
       with e ->
-       lprintf_nl "Exception in MultiFile.remove %s: %s" 
+       if !verbose then lprintf_nl "Exception in MultiFile.remove %s: %s" 
          t.dirname
           (Printexc2.to_string e);
        raise e
@@ -858,7 +858,7 @@
             Sys.remove temp_file;
             v
          with e -> 
-           lprintf_nl "Exception in SparseFile.apply_on_chunk %s %Ld %Ld: %s"
+           if !verbose then lprintf_nl "Exception in SparseFile.apply_on_chunk 
%s %Ld %Ld: %s"
              t.dirname
              chunk_begin
              chunk_len
@@ -933,7 +933,7 @@
        let st = Unix.LargeFile.stat t.dirname in
        st.Unix.LargeFile.st_mtime
       with e ->
-       lprintf_nl "Exception in SparseFile.mtime64 %s: %s"
+       if !verbose then lprintf_nl "Exception in SparseFile.mtime64 %s: %s"
          t.dirname
           (Printexc2.to_string e);
        raise e
@@ -947,7 +947,7 @@
 (*      lprintf "Removing %s\n" t.dirname; *)
        Unix2.remove_all_directory t.dirname
       with e ->
-       lprintf_nl "Exception in SparseFile.remove %s: %s" 
+       if !verbose then lprintf_nl "Exception in SparseFile.remove %s: %s" 
          t.dirname
           (Printexc2.to_string e);
        raise e
@@ -1188,7 +1188,7 @@
     buffered_bytes := !buffered_bytes -- (Int64.of_int len);
     if !verbose then lprintf_nl "written %d bytes (%Ld)" len !buffered_bytes;
   with e ->
-    lprintf_nl "exception %s in flush_buffer" (Printexc2.to_string e);
+    if !verbose then lprintf_nl "exception %s in flush_buffer" 
(Printexc2.to_string e);
     t.buffers <- (s, 0, len, offset, Int64.of_int len) :: t.buffers;
     raise e
 
@@ -1273,7 +1273,7 @@
       if !buffered_bytes <> 0L then
        lprintf_nl "[ERROR] remaining bytes after flush"
   with e ->
-      lprintf_nl "[ERROR] Exception %s in Unix32.flush"
+      if !verbose then lprintf_nl "[ERROR] Exception %s in Unix32.flush"
         (Printexc2.to_string e)
 
 let buffered_write t offset s pos_s len_s =




reply via email to

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