diff options
author | Lukas Larsson <[email protected]> | 2019-08-20 09:44:13 +0200 |
---|---|---|
committer | Lukas Larsson <[email protected]> | 2019-08-20 09:44:13 +0200 |
commit | 034ed93975f4f3f81d20f67a34e350bcb053b439 (patch) | |
tree | 289c910aebedb4a12a5e04741037dfb3e0bd6440 | |
parent | e2c6e9446cb3ce48f87909dd77ae68892e9126d5 (diff) | |
parent | d63712d2e59c6a861822fe1a2d1cd2abb9a4ff63 (diff) | |
download | otp-034ed93975f4f3f81d20f67a34e350bcb053b439.tar.gz otp-034ed93975f4f3f81d20f67a34e350bcb053b439.tar.bz2 otp-034ed93975f4f3f81d20f67a34e350bcb053b439.zip |
Merge branch 'kpy3/fix-fd-leak-in-logger/OTP-15997' into maint
* kpy3/fix-fd-leak-in-logger/OTP-15997:
Close log files in case of inode change properly
-rw-r--r-- | lib/kernel/src/logger_std_h.erl | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/kernel/src/logger_std_h.erl b/lib/kernel/src/logger_std_h.erl index 2b078ef091..8477a0fc93 100644 --- a/lib/kernel/src/logger_std_h.erl +++ b/lib/kernel/src/logger_std_h.erl @@ -457,12 +457,12 @@ maybe_ensure_file(State) -> %% In order to play well with tools like logrotate, we need to be able %% to re-create the file if it has disappeared (e.g. if rotated by %% logrotate) -ensure_file(#{fd:=Fd0,inode:=INode0,file_name:=FileName,modes:=Modes}=State) -> +ensure_file(#{inode:=INode0,file_name:=FileName,modes:=Modes}=State) -> case file:read_file_info(FileName,[raw]) of {ok,#file_info{inode=INode0}} -> State#{last_check=>timestamp()}; _ -> - close_log_file(Fd0), + close_log_file(State), case file:open(FileName,Modes) of {ok,Fd} -> {ok,#file_info{inode=INode}} = |