util: Add error handling to become_daemon()
authorMartin Schwenke <martin@meltin.net>
Tue, 15 Aug 2017 02:41:03 +0000 (12:41 +1000)
committerAndreas Schneider <asn@cryptomilk.org>
Thu, 17 Aug 2017 09:48:32 +0000 (11:48 +0200)
commit9468d0f41e37d505502f3faee736aaf3b44a17ff
tree36b1b2f92dfe3c45467a10e87890bdbaa90573e9
parented8c914b42428eaf134bb88770e4e6edaf83d494
util: Add error handling to become_daemon()

Log failure and exit if fork() or setsid() fails.

Leave the logic in the non-setsid() code as it is.  This is probably
meant to fall through on failure of either opening /dev/tty or
ioctl().  Documentation for the ioctl() failure case is far from
clear.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Andreas Schneider <asn@samba.org>
Autobuild-User(master): Andreas Schneider <asn@cryptomilk.org>
Autobuild-Date(master): Thu Aug 17 11:48:32 CEST 2017 on sn-devel-144
lib/util/become_daemon.c