logger: Fix always re-opening files when --log-fd is used
Compare changes
- Simon McVittie authored
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" Signed-off-by:
Simon McVittie <smcv@collabora.com>
+ 44
− 13
@@ -450,6 +450,10 @@ _srt_logger_setup (SrtLogger *self,
@@ -1093,7 +1097,7 @@ _srt_logger_try_rotate (SrtLogger *self,
@@ -1216,17 +1220,26 @@ logger_process_complete_line (SrtLogger *self,
@@ -1234,17 +1247,35 @@ logger_process_complete_line (SrtLogger *self,
- Comment on lines +1275 to +1277
@refi64, as a note for the future:
When you noticed that
file_stat
was not always being updated, your next question should have been: are there any other places where we can assign tofile_fd
without also updatingfile_stat
? And if you had asked yourself that question, you'd probably have found this one too.
@refi64 please note for the future:
If we are doing something significant, we should log, especially if it's something that ought to be rare under normal circumstances. Otherwise we'll have little hope of debugging it when it goes wrong. Sorry, I should have insisted on this when I reviewed !740 (merged) before.
If we want the log message to be non-user-visible the majority of the time, we can log at
g_debug()
(-v -v
) org_info()
(-v
) level.If we want the log message to be user-visible by default, we can log at
g_message()
or higher.I think
g_info()
is proportionate here.