From kde-core-devel Sat Jan 26 09:10:01 2008 From: Oswald Buddenhagen Date: Sat, 26 Jan 2008 09:10:01 +0000 To: kde-core-devel Subject: Re: [PATCH] Reset signal handlers in KProcess child Message-Id: <20080126091001.GB4351 () ugly ! local> X-MARC-Message: https://marc.info/?l=kde-core-devel&m=120133860900340 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.