diff options
| author | auric <auric@japegames.com> | 2026-02-22 18:18:36 -0600 |
|---|---|---|
| committer | auric <auric@japegames.com> | 2026-02-22 18:19:11 -0600 |
| commit | 9d113e9bb8b7d57b4a088d4991674ff068ac56bf (patch) | |
| tree | 5bdc716b569cc0ec2ad9b68efe2d68de2f0b4b93 /src/main.c | |
| parent | 52f92ea70f74008d82d21fef5085fb7380314ea1 (diff) | |
Fix log tail rotation handling and SIGHUP cleanup
- Detect IN_MOVE_SELF/IN_DELETE_SELF events in log_tail_handle and
re-open the watched path so srcds log rotation is followed correctly
- Parse inotify events rather than blindly draining them
- Call log_tail_cleanup() before log_tail_init() on SIGHUP to prevent
fd leaks on reload
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Diffstat (limited to 'src/main.c')
| -rw-r--r-- | src/main.c | 7 |
1 files changed, 4 insertions, 3 deletions
@@ -59,10 +59,11 @@ static void handle_signal(void) { case SIGHUP: log_info("SIGHUP received — reloading units"); + log_tail_cleanup(); /* Reload unit descriptors. Existing runtime state is preserved. */ g.unit_count = 0; unit_load_all(); - log_tail_init(); + log_tail_init(); break; } } @@ -206,8 +207,6 @@ int main(int argc, char *argv[]) { ev.data.fd = g.signal_fd; epoll_ctl(g.epoll_fd, EPOLL_CTL_ADD, g.signal_fd, &ev); - log_tail_init(); - /* Load unit descriptors */ if (unit_load_all() < 0) { log_error("Failed to load units"); @@ -215,6 +214,8 @@ int main(int argc, char *argv[]) { return 1; } + log_tail_init(); + /* Set up listening socket */ g.listen_fd = client_listen(); if (g.listen_fd < 0) { |
