mldonkey-commits
[Top][All Lists]
Advanced

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

[Mldonkey-commits] mldonkey distrib/ChangeLog src/daemon/common/co...


From: mldonkey-commits
Subject: [Mldonkey-commits] mldonkey distrib/ChangeLog src/daemon/common/co...
Date: Tue, 28 Nov 2006 23:52:18 +0000

CVSROOT:        /sources/mldonkey
Module name:    mldonkey
Changes by:     spiralvoice <spiralvoice>       06/11/28 23:52:18

Modified files:
        distrib        : ChangeLog 
        src/daemon/common: commonInteractive.ml commonOptions.ml 
        src/daemon/driver: driverCommands.ml 
        src/utils/cdk  : unix2.ml 
        src/utils/lib  : unix32.ml unix32.mli 

Log message:
        patch #5589

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/mldonkey/distrib/ChangeLog?cvsroot=mldonkey&r1=1.1120&r2=1.1121
http://cvs.savannah.gnu.org/viewcvs/mldonkey/src/daemon/common/commonInteractive.ml?cvsroot=mldonkey&r1=1.85&r2=1.86
http://cvs.savannah.gnu.org/viewcvs/mldonkey/src/daemon/common/commonOptions.ml?cvsroot=mldonkey&r1=1.190&r2=1.191
http://cvs.savannah.gnu.org/viewcvs/mldonkey/src/daemon/driver/driverCommands.ml?cvsroot=mldonkey&r1=1.202&r2=1.203
http://cvs.savannah.gnu.org/viewcvs/mldonkey/src/utils/cdk/unix2.ml?cvsroot=mldonkey&r1=1.31&r2=1.32
http://cvs.savannah.gnu.org/viewcvs/mldonkey/src/utils/lib/unix32.ml?cvsroot=mldonkey&r1=1.65&r2=1.66
http://cvs.savannah.gnu.org/viewcvs/mldonkey/src/utils/lib/unix32.mli?cvsroot=mldonkey&r1=1.23&r2=1.24

Patches:
Index: distrib/ChangeLog
===================================================================
RCS file: /sources/mldonkey/mldonkey/distrib/ChangeLog,v
retrieving revision 1.1120
retrieving revision 1.1121
diff -u -b -r1.1120 -r1.1121
--- distrib/ChangeLog   28 Nov 2006 23:50:33 -0000      1.1120
+++ distrib/ChangeLog   28 Nov 2006 23:52:17 -0000      1.1121
@@ -15,6 +15,8 @@
 =========
 
 2006/11/29
+5589: New option create_file_mode,
+      rename create_dir_mask to create_dir_mode (pango)
 5595: EDK: Fully parse emule_miscoptions1/2
 5594: EDK: If update_server_list_client true, add yet unknown server
       of lowid clients

Index: src/daemon/common/commonInteractive.ml
===================================================================
RCS file: /sources/mldonkey/mldonkey/src/daemon/common/commonInteractive.ml,v
retrieving revision 1.85
retrieving revision 1.86
diff -u -b -r1.85 -r1.86
--- src/daemon/common/commonInteractive.ml      26 Nov 2006 13:54:09 -0000      
1.85
+++ src/daemon/common/commonInteractive.ml      28 Nov 2006 23:52:17 -0000      
1.86
@@ -222,7 +222,7 @@
          let new_name = file_commited_name incoming.shdir_dirname file in
            if Unix2.is_directory file_name then begin
              Unix2.safe_mkdir new_name;
-             Unix2.chmod new_name (Misc.int_of_octal_string !!create_dir_mask)
+             Unix2.chmod new_name !Unix32.create_dir_mode;
            end;
 
 (*          the next line really moves the file *)

Index: src/daemon/common/commonOptions.ml
===================================================================
RCS file: /sources/mldonkey/mldonkey/src/daemon/common/commonOptions.ml,v
retrieving revision 1.190
retrieving revision 1.191
diff -u -b -r1.190 -r1.191
--- src/daemon/common/commonOptions.ml  28 Nov 2006 23:15:21 -0000      1.190
+++ src/daemon/common/commonOptions.ml  28 Nov 2006 23:52:17 -0000      1.191
@@ -1267,8 +1267,12 @@
   "The directory where temporary files should be put"
     string_option "temp"
 
-let create_dir_mask = define_option current_section ["create_dir_mask"]
-  "New directories in incoming_directories are created with these rights"
+let create_file_mode = define_option current_section ["create_file_mode"]
+  "New download files are created with these rights (in octal)"
+    string_option "664"
+
+let create_dir_mode = define_option current_section ["create_dir_mode"]
+  "New directories in incoming_directories are created with these rights (in 
octal)"
     string_option "755"
 
 let create_file_sparse = define_option current_section ["create_file_sparse"]
@@ -1497,9 +1501,12 @@
       TcpBufferedSocket.copy_read_buffer := !!copy_read_buffer
   )
 
-let _ =
-  option_hook create_dir_mask (fun _ ->
-      Unix32.create_dir_mask := !!create_dir_mask
+let () =
+  option_hook create_file_mode (fun _ ->
+      Unix32.create_file_mode := Misc.int_of_octal_string !!create_file_mode
+  );
+  option_hook create_dir_mode (fun _ ->
+      Unix32.create_dir_mode := Misc.int_of_octal_string !!create_dir_mode
   )
 
 let create_mlsubmit = define_expert_option current_section ["create_mlsubmit"]

Index: src/daemon/driver/driverCommands.ml
===================================================================
RCS file: /sources/mldonkey/mldonkey/src/daemon/driver/driverCommands.ml,v
retrieving revision 1.202
retrieving revision 1.203
diff -u -b -r1.202 -r1.203
--- src/daemon/driver/driverCommands.ml 28 Nov 2006 23:15:21 -0000      1.202
+++ src/daemon/driver/driverCommands.ml 28 Nov 2006 23:52:17 -0000      1.203
@@ -1777,7 +1777,8 @@
                        strings_of_option allow_browse_share;
                        strings_of_option auto_commit;
                        strings_of_option pause_new_downloads;
-                       strings_of_option create_dir_mask;
+                       strings_of_option create_file_mode;
+                       strings_of_option create_dir_mode;
                        strings_of_option create_file_sparse;
                        strings_of_option log_file;
                        strings_of_option log_file_size;

Index: src/utils/cdk/unix2.ml
===================================================================
RCS file: /sources/mldonkey/mldonkey/src/utils/cdk/unix2.ml,v
retrieving revision 1.31
retrieving revision 1.32
diff -u -b -r1.31 -r1.32
--- src/utils/cdk/unix2.ml      12 Aug 2006 20:36:14 -0000      1.31
+++ src/utils/cdk/unix2.ml      28 Nov 2006 23:52:17 -0000      1.32
@@ -89,7 +89,7 @@
   with e -> 
     lprintf_nl "warning: chmod failed on %s: %s" f (Printexc2.to_string e)
 
-let rec safe_mkdir dir =  
+let rec safe_mkdir ?(mode = 0o775) dir =  
   if Sys.file_exists dir then begin
     if not (is_directory dir) then 
       failwith (Printf.sprintf "%s already exists but is not a directory" dir)
@@ -112,7 +112,7 @@
       let predir = Filename.dirname dir in
       if predir <> dir then safe_mkdir predir;
       try
-        Unix.mkdir dir 0o775
+        Unix.mkdir dir mode
       with
        Unix.Unix_error (EEXIST, _, _) -> ()
       | e -> lprintf_nl "error %s for directory %s" (Printexc2.to_string e) 
dir; exit 73
@@ -136,7 +136,13 @@
 
 let copy oldname newname =
   tryopen_read_bin oldname (fun ic ->
+    let stats = Unix.fstat (Unix.descr_of_in_channel ic) in
     tryopen_write_bin newname (fun oc ->
+      let descr = Unix.descr_of_out_channel oc in
+      (try Unix.fchown descr stats.Unix.st_uid stats.Unix.st_gid 
+       with e -> lprintf_nl "copy: failed to preserve owner");
+      (try Unix.fchmod descr stats.Unix.st_perm 
+       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.65
retrieving revision 1.66
diff -u -b -r1.65 -r1.66
--- src/utils/lib/unix32.ml     15 Jul 2006 11:52:54 -0000      1.65
+++ src/utils/lib/unix32.ml     28 Nov 2006 23:52:18 -0000      1.66
@@ -31,15 +31,14 @@
   
 let max_buffered = ref (Int64.of_int (1024 * 1024))
   
-let create_dir_mask = ref "755"
+let create_file_mode = ref 0o664
+let create_dir_mode = ref 0o755
 let verbose = ref false
 let max_cache_size = ref 50
   
 let mini (x: int) (y: int) =
   if x > y then y else x
     
-let rights = 0o664
-  
 let ro_flag =  [Unix.O_RDONLY]
 let rw_flag =  [Unix.O_RDWR]
 let rw_creat_flag =  [Unix.O_CREAT; Unix.O_RDWR]
@@ -121,7 +120,8 @@
                try
                  if t.writable then
                     Unix.openfile t.filename 
-                     (if creat then rw_creat_flag else rw_flag) rights
+                     (if creat then rw_creat_flag else rw_flag) 
+                     !create_file_mode
                  else
                    Unix.openfile t.filename ro_flag 0o400
                with e ->
@@ -255,7 +255,7 @@
       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.chmod d !create_dir_mode;
        Unix2.can_write_to_directory d);
       (try
         Unix2.rename t.filename (Filename.concat f file);

Index: src/utils/lib/unix32.mli
===================================================================
RCS file: /sources/mldonkey/mldonkey/src/utils/lib/unix32.mli,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -b -r1.23 -r1.24
--- src/utils/lib/unix32.mli    6 Mar 2006 18:02:16 -0000       1.23
+++ src/utils/lib/unix32.mli    28 Nov 2006 23:52:18 -0000      1.24
@@ -26,7 +26,8 @@
 val uname : unit -> string
 val os_supported : unit -> bool
 
-val create_dir_mask : string ref
+val create_file_mode : int ref
+val create_dir_mode : int ref
 val close : t -> unit
 (* val force_fd : t -> Unix.file_descr *)
   




reply via email to

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