Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!swrinde!elroy.jpl.nasa.gov!decwrl!stanford.edu!leland.Stanford.EDU!dkeisen From: dkeisen@leland.Stanford.EDU (Dave Eisen) Newsgroups: comp.unix.programmer Subject: Re: possible race condition? Message-ID: <1991May9.210334.28601@leland.Stanford.EDU> Date: 9 May 91 21:03:34 GMT References: <1991May9.144935.20078@ge-dab.GE.COM> Organization: Sequoia Peripherals, Inc. Lines: 24 In article <1991May9.144935.20078@ge-dab.GE.COM> coleman@sunny.dab.ge.com (Richard Coleman) writes: > > > if (fork() != 0) > exit(0); /* parent process exits */ > setpgrp(); /* change process group and lose control tty */ > signal(SIGHUP,SIG_IGN); >Now my questions is this : when the parent process exits, it sends the >signal SIGHUP to all processes in its process group. Is it possible for This only happens if the parent process is a process group leader which won't ordinarily be the case. But, daemons should be paranoid, and besides, this problem is easy to fix --- just move the signal call above the first fork and the SIGHUP that might be generated when the parent dies is safely ignored in the child. -- Dave Eisen dkeisen@leland.Stanford.EDU 1101 San Antonio Raod, Suite 102 (Gang-of-Four is being taken off the net) Mountain View, CA 94043 (415) 967-5644