Skip to content

Commit 1694206

Browse files
author
Jan Rochel
committed
access/warning/error.log: allow for symlinks to /dev/null
1 parent 81b01e9 commit 1694206

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

src/baselib/ocsigen_messages.ml

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -96,9 +96,16 @@ let open_files ?(user = Ocsigen_config.get_user ()) ?(group = Ocsigen_config.get
9696
(Unix.getpwnam user).Unix.pw_uid
9797
with Not_found as e -> ignore (Lwt_log.error "Error: Wrong user"); raise e)
9898
in
99-
Lwt_unix.chown (full_path access_file) uid gid >>= fun () ->
100-
Lwt_unix.chown (full_path warning_file) uid gid >>= fun () ->
101-
Lwt_unix.chown (full_path error_file) uid gid
99+
Lwt.catch
100+
(fun () ->
101+
Lwt_unix.chown (full_path access_file) uid gid >>= fun () ->
102+
Lwt_unix.chown (full_path warning_file) uid gid >>= fun () ->
103+
Lwt_unix.chown (full_path error_file) uid gid)
104+
(fun e -> match e with
105+
| Unix.Unix_error (Unix.EPERM, _, _) ->
106+
(* to allow for symlinks to /dev/null *)
107+
Lwt.return_unit
108+
| _ -> Lwt.fail e)
102109

103110
(****)
104111

0 commit comments

Comments
 (0)