Commit 7faec405 authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

signals: ignore SIGHUP if its handler is SIG_IGN

This works around GNU coreutils nohup not working with VLC.
Pointed-out-by: default avatarGilles Chanteperdrix <gilles.chanteperdrix@xenomai.org>
parent 6f8cdd0f
......@@ -84,6 +84,16 @@ static void Close (vlc_object_t *obj)
free (p_sys);
}
static bool ignored (int signum)
{
struct sigaction sa;
if (sigaction (signum, NULL, &sa))
return false;
return ((sa.sa_flags & SA_SIGINFO)
? (void *)sa.sa_sigaction : (void *)sa.sa_handler) == SIG_IGN;
}
static void *SigThread (void *data)
{
intf_thread_t *obj = data;
......@@ -91,7 +101,8 @@ static void *SigThread (void *data)
int signum;
sigemptyset (&set);
sigaddset (&set, SIGHUP);
if (!ignored (SIGHUP)) /* <- needed to handle nohup properly */
sigaddset (&set, SIGHUP);
sigaddset (&set, SIGINT);
sigaddset (&set, SIGQUIT);
sigaddset (&set, SIGTERM);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment