monit-general
[Top][All Lists]
Advanced

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

Re: Monit doesn't detach from the tty


From: Mark Ferlatte
Subject: Re: Monit doesn't detach from the tty
Date: Wed, 7 Aug 2002 17:51:57 -0700
User-agent: Mutt/1.4i

On Wed, Aug 07, 2002 at 05:40:39PM -0700, Rory Toma wrote (0.15):
> 1) why use _exit(0) instead of exit(0)?

monit registers an atexit() handler in log.c, and calling exit() would
trigger it, which would be incorrect.  _exit() doesn't run atexit()
handlers, which is correct in daemonize().

> 2) I noticed that we also keep fd 0, 1 and 2 open. Generally, I've used
> dup2 to copy 0 1 and 2 to and closed them off.

It looks like it tries to do this in env.c:set_sandbox(), but I don't
think it does it correctly: it only opens 0,1 and 2 to /dev/null if they
are closed before set_sandbox() gets called... and it doesn't look like
they ever get closed, so they remain open (pointing at the tty, I'd
imagine).  They probably should get closed first, and then reopened
pointing to /dev/null.

Course, this particular bug hasn't bit me yet, so <shrug>I
dunno</shrug>.

M

Attachment: pgpYIfxPpXclM.pgp
Description: PGP signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]