mldonkey-bugs
[Top][All Lists]
Advanced

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

[Mldonkey-bugs] [bug #12415] shared and downloading files are rw-locked


From: spiralvoice
Subject: [Mldonkey-bugs] [bug #12415] shared and downloading files are rw-locked under windows
Date: Sun, 22 May 2005 13:29:48 +0000
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; de-DE; rv:1.7.7) Gecko/20050418 Firefox/1.0.3 (MOOX M2)

Update of bug #12415 (project mldonkey):

                 Release:                2-5-28-1 => 2.5.30.15              
        Platform Version:        Cygwin W2K/WinXP => MinGW W2K/WinXP        

    _______________________________________________________

Follow-up Comment #2:

Can confirm this: hashing and sharing files with MLDonkey 2.5.30.15
blocks access with Windows Media Player. VLC can play those files...
Problem is in Unix32.read which opens files rw by default...
Also some functions like getsize64 do this also...

I did several things which I will describe here, hashing a file
and playing it with Windows Media Player works here now.

First I appended ro_flag with Unix.O_NONBLOCK, canĀ“t be bad:
http://pauillac.inria.fr/~guesdon/Tools/doc_ocaml_classic/Unix.html#TYPEopen_flag
|       O_NONBLOCK      (*      Open in non-blocking mode       *)

Then changed commonHasher.ml to use this flag instead of a hardcoded one.

Then Unix32.FDCache.local_force_fd opened files rw by default
which was the source of the problems described in this bug.

Unix32.read calls DiskFile.read, MultiFile.read or Sparsefile.Read depending
on filetype:

let read t file_pos string string_pos len =
  flush_fd t;
  match t.file_kind with
  | DiskFile t -> DiskFile.read t file_pos string string_pos len
  | MultiFile t -> MultiFile.read t file_pos string string_pos len
  | SparseFile t -> SparseFile.read t file_pos string string_pos len

All those read functions like this one:

module DiskFile = struct
    let read = FDCache.read

module FDCache = struct
     let read file file_pos string string_pos len =
      let fd = local_force_fd file in

called FDCache.local_force_fd which opens all files rw by default:

try
  Unix.openfile t.filename rw_flag rights
with Unix.Unix_error( (Unix.EACCES | Unix.EROFS) ,_,_) ->
  Unix.openfile t.filename ro_flag 0o400

I appended FDCache.local_force_fd with a flag to distinguish
between "ro" and "rw" and changed only this functions which are
clearly read-only functions to this flag and left the rest
untouched.

    _______________________________________________________

Reply to this item at:

  <http://savannah.nongnu.org/bugs/?func=detailitem&item_id=12415>

_______________________________________________
  Nachricht geschickt von/durch Savannah
  http://savannah.nongnu.org/





reply via email to

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