Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion src/daemon.c
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ static void normal_stop_handler(int num)

static void log_reopen_handler(int num)
{
yaz_log(YLOG_LOG, "SIGHUP received, reopening log file");
yaz_log_reopen();
if (child_pid)
kill(child_pid, num);
Expand Down Expand Up @@ -334,7 +335,11 @@ int yaz_daemon(const char *progname,

if (flags & YAZ_DAEMON_LOG_REOPEN)
{
signal(SIGHUP, log_reopen_handler);
struct sigaction sa;
sigemptyset(&sa.sa_mask);
sa.sa_handler = log_reopen_handler;
sa.sa_flags = 0;
sigaction(SIGHUP, &sa, 0);
Copy link

Copilot AI Jan 10, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The third argument to sigaction should be NULL instead of 0 for better code clarity. While 0 is technically valid, using NULL makes it explicit that this is a pointer argument and improves code readability.

Suggested change
sigaction(SIGHUP, &sa, 0);
sigaction(SIGHUP, &sa, NULL);

Copilot uses AI. Check for mistakes.
}
if (flags & YAZ_DAEMON_KEEPALIVE)
{
Expand Down