I am writing a Linux daemon . I found two ways to do it.
fork()
sid
&
Which is the right way to do it?
The first. The second is not daemonizing, but running on the background. Daemonized programs should be on its own session and process group, and should not have a controlling terminal.