Included below is a warning from the setsid(2) manpage for
Solaris. Something like this should be included in the linux man
page.
WARNINGS
A call to setsid() by a process that is a process group
leader will fail. A process can become a process group
leader by being the last member of a pipeline started by a
job control shell. Thus, a process that expects to be part
of a pipeline, and that calls setsid(), should always first
fork; the parent should exit and the child should call set-
sid(). This will ensure that the calling process will work
reliably when started by both job control shells and non-job
control shells.
-- Michiel Boland <boland@sci.kun.nl> University of Nijmegen The Netherlands