@@ -668,12 +668,8 @@ 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.
677673 */
678674 int log_fds [TOR_SIGSAFE_LOG_MAX_FDS ];
679675 int err_fds [TOR_SIGSAFE_LOG_MAX_FDS ];
@@ -704,12 +700,10 @@ tor_log_update_sigsafe_err_fds(void)
704700 log_fds [n_fds ] = lf -> fd ;
705701 if (lf -> needs_close ) {
706702 /* File log fds are duplicated, because close_log() closes the log
707- * module's fd, and tor_log_close_sigsafe_err_fds() closes the err
708703 * module's fd. Both refer to the same file. */
709704 err_fds [n_fds ] = dup (lf -> fd );
710705 } else {
711- /* stdio log fds are not closed by the log module.
712- * tor_log_close_sigsafe_err_fds() closes stdio logs. */
706+ /* stdio log fds are not closed by the log module. */
713707 err_fds [n_fds ] = lf -> fd ;
714708 }
715709 n_fds ++ ;
@@ -838,30 +832,6 @@ logs_free_all(void)
838832 * log mutex. */
839833}
840834
841- /** Close signal-safe log files.
842- * Closing the log files makes the process and OS flush log buffers.
843- *
844- * This function is safe to call from a signal handler. It should only be
845- * called when shutting down the log or err modules. It is currenly called
846- * by the err module, when terminating the process on an abnormal condition.
847- */
848- void
849- logs_close_sigsafe (void )
850- {
851- logfile_t * victim , * next ;
852- /* We can't LOCK_LOGS() in a signal handler, because it may call
853- * signal-unsafe functions. And we can't deallocate memory, either. */
854- next = logfiles ;
855- logfiles = NULL ;
856- while (next ) {
857- victim = next ;
858- next = next -> next ;
859- if (victim -> needs_close ) {
860- close_log_sigsafe (victim );
861- }
862- }
863- }
864-
865835/** Remove and free the log entry <b>victim</b> from the linked-list
866836 * logfiles (it is probably present, but it might not be due to thread
867837 * racing issues). After this function is called, the caller shouldn't
0 commit comments