Re: [LIP] [Update] Sending TERM, and signal handler issue.

Nirendra Awasthi <[email protected]>
Newsgroups gmane.user-groups.linux.india.programmers
Message-ID <[email protected]>
On Wed, 2004-10-20 at 10:42, Amarendra Godbole wrote:
> Hi,I had posted this query yesterday about a suspected signal handler
> screwup. I need your inputs to go about this issue, here is a program that > >
simulates this behavior -
<snip>
> void term_handle(int signo) {
>          printf("Okay, caught %d.\n", signo);         
> printf("Going to sleep.\n", signo);         
> sleep(15);
> }

This is happening as term_handle is called again for SIGTERM before your program
exits. 
You can add 

signal(SIGTERM, SIG_IGN); or 
signal(SIGTERM, SIG_DFL);  

as the first line of your term_handle function to ignore this signal or take the
default action next time it receives this signal.

- Nirendra
http://www.nirendra.net


----------------------------------------------------------------
This message was sent using IMP, the Internet Messaging Program.



-------------------------------------------------------
This SF.net email is sponsored by: IT Product Guide on ITManagersJournal
Use IT products in your business? Tell us what you think of them. Give us
Your Opinions, Get Free ThinkGeek Gift Certificates! Click to find out more
http://productguide.itmanagersjournal.com/guidepromo.tmpl
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.