« Previous | Next » 

Revision a4c0fe1e

IDa4c0fe1e147840f24b5f866e4ebbc7e3bf71cd87
Parent e080072c
Child 62457f51

Added by Iustin Pop over 11 years ago

Fix PID file writing in Haskell daemons

Currently, the code uses createFile, which has the effect of always
truncating the file. This is bad, as the content of the PID file is
wiped even when we wouldn't be able to lock it!

We switch to openFd (createFile is just a wrapper over that), and we
use an explicit set of flags; defaultFileFlags is already safe
(trunc=False), but I prefer to set it explicitly with our desired
flags.

Note that this bug doesn't manifest in normal usage, as daemon-util
won't try to start the daemon if already running. But if anyone or
anything does call ganeti-confd explicitly, the pid file will be
emptied and the daemon will keep trying to be restarted forever…

Signed-off-by: Iustin Pop <>
Reviewed-by: Guido Trotter <>

Files

  • added
  • modified
  • copied
  • renamed
  • deleted

View differences