File tree Expand file tree Collapse file tree 3 files changed +6
-3
lines changed
Expand file tree Collapse file tree 3 files changed +6
-3
lines changed Original file line number Diff line number Diff line change @@ -29,7 +29,8 @@ let tail ?switch t dst =
2929 match t.state with
3030 | `Finished -> invalid_arg " tail: log is finished!"
3131 | `Readonly path ->
32- Lwt_io. (with_file ~mode: input) path @@ fun ch ->
32+ let flags = [Unix. O_RDONLY ; Unix. O_NONBLOCK ; Unix. O_CLOEXEC ] in
33+ Lwt_io. (with_file ~mode: input ~flags ) path @@ fun ch ->
3334 let buf = Bytes. create max_chunk_size in
3435 let rec aux () =
3536 Lwt_io. read_into ch buf 0 max_chunk_size >> = function
Original file line number Diff line number Diff line change @@ -90,7 +90,8 @@ let rec write_all fd buf ofs len =
9090 )
9191
9292let write_file ~path contents =
93- Lwt_io. (with_file ~mode: output) path @@ fun ch ->
93+ let flags = [Unix. O_WRONLY ; Unix. O_CREAT ; Unix. O_TRUNC ; Unix. O_NONBLOCK ; Unix. O_CLOEXEC ] in
94+ Lwt_io. (with_file ~mode: output ~flags ) path @@ fun ch ->
9495 Lwt_io. write ch contents
9596
9697let with_pipe_from_child fn =
Original file line number Diff line number Diff line change @@ -65,7 +65,8 @@ let copy_file ~src ~dst ~to_untar ~user =
6565 dst stat.Lwt_unix.LargeFile. st_size
6666 in
6767 Tar_lwt_unix. write_block ~level hdr (fun ofd ->
68- Lwt_io. (with_file ~mode: input) src (copy_to ~dst: ofd)
68+ let flags = [Unix. O_RDONLY ; Unix. O_NONBLOCK ; Unix. O_CLOEXEC ] in
69+ Lwt_io. (with_file ~mode: input ~flags ) src (copy_to ~dst: ofd)
6970 ) to_untar
7071
7172let copy_symlink ~src ~target ~dst ~to_untar ~user =
You can’t perform that action at this time.
0 commit comments