I first tried to use the code in this question: Creating a daemon in Linux
But I got a SIGFAULT
caused by a fgetc call.
I then tried int daemon(int nochdir, int noclose);
function, and it seems perfectly working.
Also, using ps -xj
, I can see the behaviour described in the answer of the linked question so it's really working as I wanted to).
What's the difference between the two ways?