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

Re: Clarification about bug #463538 is needed



On Sat, Jul 19, 2008 at 09:28:03PM +0400, Sergei Golovan wrote:
> On 7/19/08, Martijn van Oosterhout <kleptog@gmail.com> wrote:
> >
> > Umm, if that patch fixes it (removing the TIOCSCTTY) then it seems to
> >  me that the erlang-based service will instead exit when the user who
> >  installed the server logs out. Evidently the services in erlang are
> >  not properly disassociating themselves from the terminal and this
> >  patch just makes it more obvious...
> 
> Erlang does exactly the following when detaches from a terminal:
> 
>  if (start_detached) {
>    int status = fork();
>    if (status != 0)
>      return 0;
>    status = fork();
>    if (status != 0)
>      return 0;
> 
>    close(0);
>    open("/dev/null", O_RDONLY);
>    close(1);
>    open("/dev/null", O_WRONLY);
>    close(2);
>    open("/dev/null", O_WRONLY);
>  }
>  {
>    execv(emu, Eargsp); /* executing the main Erlang emulator */
>  }
> 
> Is this behavior incorrect?

It should also open /dev/tty and ioctl(fd, TIOCNOTTY, 0) on it.

Mike


Reply to: