trace-cmd agent: Move becoming daemon after prints and errors

When starting the agent in daemon mode, it should be done after the
connections to the vsocket, so that it can not only show the user what
port it is connected to, but also show any errors that may happen.

Once the task becomes a daemon, it will no longer print its error messages
or normal information to the console. Thus any errors that happen after
the daemon is running will go unnoticed.

Link: https://lore.kernel.org/linux-trace-devel/20220314173714.01f226d6@gandalf.local.home

Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
1 file changed