Skip to content

logger: Fix always re-opening files when --log-fd is used

Ryan Gonzalez requested to merge wip/refi64/logger-reopen-fix into main
  • logger: Fix always re-opening files when --log-fd is used

    From: @refi64

    self->file_stat was only initialized if an fd was not given, which would lead it to always re-create the log file once.

    steamrt/tasks#487

  • logger: Fix unneeded memcpy

    From: @refi64

    I wasn't aware that simple assignment worked here.

    steamrt/tasks#487

  • logger: When we reopen a file, make sure to record its new identity

    Otherwise, after reopening a deleted or replaced file, we would reopen it once per line, because its inode number constantly differs from the original inode number.

    After commit 1f502cb4 "logger: Fix always re-opening files when --log-fd is used", this was the only remaining place where we assign to self->file_fd without also assigning to self->file_stat.

    Fixes: 8f65507d "logger: Recreate output log files if they get deleted"

  • logger: When we reopen a file, log an info message that says why

    This would have made it considerably easier to spot that commit 8f65507d "logger: Recreate output log files if they get deleted" was reopening the log file more often than it should have been.

  • logger: Consistently mention the log file name in warnings

Edited by Simon McVittie

Merge request reports