vext01/hgd — Issue #139: Wrong pid written to .pid file on Linux
Author: shaun2029
Created: 2011-12-02 19:15:11+00:00
State: open

The pids written to /var/hgd/hgd-playd.pid and /var/hgd/hgd-netd.pid are incorrect.

The call to hgd_daemonise() seems changes the pid of the process. This results in hgd-admin not working as expected.

/* Do this before daemonising so we can see its output if it fails. */
if (hgd_write_pid_file() != HGD_OK) {
DPRINTF(HGD_D_ERROR, "Can't write PID away");
return (HGD_FAIL);
}

/* alright, everything looks good, lets be a daemon and background */
if (background)
hgd_daemonise();

hgd_listen_loop();

Testing on Ubuntu 11.10 Oneiric.