Skip to content

Commit d139807

Browse files
committed
log/err: Update comments now that we flush log fds
Part of 33087.
1 parent 1f6f4cf commit d139807

File tree

3 files changed

+5
-10
lines changed

3 files changed

+5
-10
lines changed

src/lib/err/torerr.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,7 @@ tor_raw_assertion_failed_msg_(const char *file, int line, const char *expr,
212212

213213
/**
214214
* Call the abort() function to kill the current process with a fatal
215-
* error. But first, close the raw error file descriptors, so error messages
215+
* error. But first, flush the raw error file descriptors, so error messages
216216
* are written before process termination.
217217
**/
218218
void

src/lib/err/torerr_sys.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,8 @@ subsys_torerr_initialize(void)
2727
static void
2828
subsys_torerr_shutdown(void)
2929
{
30-
/* Stop handling signals with backtraces, then close the logs. */
30+
/* Stop handling signals with backtraces, then flush the logs. */
3131
clean_up_backtrace_handler();
32-
/* We can't log any log messages after this point: we've closed all the log
33-
* fds, including stdio. */
3432
tor_log_flush_sigsafe_err_fds();
3533
}
3634

src/lib/log/log.c

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -668,12 +668,9 @@ tor_log_update_sigsafe_err_fds(void)
668668

669669
/* log_fds and err_fds contain matching entries: log_fds are the fds used by
670670
* the log module, and err_fds are the fds used by the err module.
671-
* For stdio logs, the log_fd and err_fd values are identical,
672-
* and the err module closes the fd on shutdown.
673-
* For file logs, the err_fd is a dup() of the log_fd,
674-
* and the log and err modules both close their respective fds on shutdown.
675-
* (Once all fds representing a file are closed, the underlying file is
676-
* closed.)
671+
* For stdio logs, the log_fd and err_fd values are identical.
672+
* For file logs, the err_fd is a dup() of the log_fd.
673+
* Both the log and err modules flush these fds on shutdown.
677674
*/
678675
int log_fds[TOR_SIGSAFE_LOG_MAX_FDS];
679676
int err_fds[TOR_SIGSAFE_LOG_MAX_FDS];

0 commit comments

Comments
 (0)