[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-core-devel
Subject:    Re: [PATCH] Reset signal handlers in KProcess child
From:       Oswald Buddenhagen <ossi () kde ! org>
Date:       2008-01-26 9:10:01
Message-ID: 20080126091001.GB4351 () ugly ! local
[Download RAW message or body]

On Sat, Jan 26, 2008 at 04:22:55AM +0000, Robert Knight wrote:
> K3Process used to reset signal handler for all signals to SIG_DFL just
> after forking.
>
uh, right. but it did this after calling commSetupDoneC()
(k3proc setupChildProcess() equivalent), thus leaving the app no chance
to set up signal ignores on purpose. so: bug there, too. :)

> Konsole ultimately inherited SIGINT from somewhere else, it looks like
> KDM might be the cause
> 
whooops ... that must have persisted for > 5 years. :}

> The attached patch causes KProcess to reset its child's signal
> handlers back to SIG_DFL in setupChildProcess().  Is this the right
> solution?
> 
as thiago pointed out, this probably needs to be addressed by tt.
given that MSDN says "Signal settings are not preserved in spawned
processes created by calls to _exec or _spawn functions. The signal
settings are reset to the default in the new process." and QProcess is
probably expected to behave the same under unix and win, this can be
considered a bug, indeed. i'm just a bit concerned about backwards
compatibility.

> +void KProcess::setupChildProcess()
> +{
> +#ifndef Q_OS_WIN
> +	// reset all signal handlers
> +	struct sigaction action;
> +	sigemptyset(&action.sa_mask);
> +	action.sa_handler = SIG_DFL;
> +	action.sa_flags = 0;
> +	for (int signal = 1; signal < NSIG; signal++)
> +		sigaction(signal, &action, 0);
> +#endif
> +}

-- 
Hi! I'm a .signature virus! Copy me into your ~/.signature, please!
--
Confusion, chaos, panic - my work here is done.
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic