Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions lib/logger/log_device.rb
Original file line number Diff line number Diff line change
Expand Up @@ -236,17 +236,17 @@ def shift_log_file(shifted)
@dev = create_logfile(@filename)
mode, uid, gid = stat.mode, stat.uid, stat.gid
begin
@dev.chmod(mode) if mode
mode = nil
@dev.chown(uid, gid)
rescue Errno::EPERM
if mode
# failed to chmod, probably nothing can do more.
elsif uid
uid = nil
retry # to change gid only
begin
@dev.chown(nil, gid) if uid
rescue Errno::EPERM
end
end
begin
@dev.chmod(mode) if mode
rescue Errno::EPERM
end
return true
end
end
Expand Down