[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#152268: More info

On Mon, 8 Jul 2002, Wichert Akkerman wrote:
> Previously Stephen J. Turnbull wrote:
> > SigInit: setpgid failed (1)
> Can you try and figure out why setpgid fails? If 1 is the errno the
> reason would be EPERM, which means the bug is not in start-stop-daemon.

Yes, the 1 is an errno, the code is:

void SigInit(void)
    /* Establish/Join our own process group to avoid extraneous signals. */
#ifndef DJGPP
  if (setpgid(0, 0) < 0)
    CHOKE("SigInit: setpgid failed (%d)", errno);
#endif /* !DJGPP */

On Mon, 12 Jul 2002, Adam Heath wrote:
> Er, maybe.  s-s-d in 1.10 now uses setsid(), instead of setpgid()(this is
> detected at compile time).  Is setpgid() not allowed to be called after
> setsid() has been?

That seems to be the problem. From setsid(2):

       On error, -1 will be returned.  The only error  which  can
       happen  is EPERM. It is returned when the process group ID
       of any process equals the  PID  of  the  calling  process.
       Thus,  in  particular, setsid fails if the calling process
       is already a process group leader.

However setpgid(2) states:

       setpgid sets the process group ID of the process specified
       by  pid  to  pgid.   If pid is zero, the process ID of the
       current process is used.  If pgid is zero, the process  ID
       of  the  process  specified by pid is used. [...]

When setpgid(0, 0) is called (like venus does) it seems to crash
because the pgid is already set to the pid...


Thimo Neubauer <thimo@debian.org>
Debian GNU/Linux 3.0 "woody" is finally released! CD-Images are
available via http://cdimage.debian.org/, for detailed information 
about Debian see http://www.debian.org/

Attachment: pgpDQvMaZP7J9.pgp
Description: PGP signature

Reply to: