signal() is unsafe, unportable, and deprecated.   sigaction() is almost
always preferred.   (On SysV OS'es, including Solaris, signal() resets
the signal handler to the default when the signal is received, leaving
a race condition before the handler can reassert it - sigaction does not
do this.   See "Advanced Programming in the Unix Environment" or "Solaris
Systems Programming" for much greater details - Sun employees can read
either online for free through Sun's safari subscription.   A shorter
online description can be read at:
http://stackoverflow.com/questions/231912/what-is-the-difference-between-sigaction-and-signal
)

I'll bet the actual cause and more correct fix is the failure to initialize
the sa_mask & sa_flags members of the sigaction struct, and the failure to
check if sigaction() returned an error.

        -Alan Coopersmith-           alan.coopersmith at sun.com
         Sun Microsystems, Inc. - X Window System Engineering


Halton Huo wrote:
> Hi,
> 
> console-kit-daemon will receive SIGPOLL when VT is switched, this will
> cause c-k-d exit. It is because the process does not go into
> handle_vt_active() as we wish.
> 
> Aaron helps me find out that using signal() rather than sigaction() fix
> this issue.
>       
> Refer to bug http://defect.opensolaris.org/bz/show_bug.cgi?id=11612 for
> more information.
> 
> Thanks,
> Halton.
> 

Reply via email to