diff options
author | Martin Schwenke <martin@meltin.net> | 2014-07-03 12:12:20 +1000 |
---|---|---|
committer | Amitay Isaacs <amitay@samba.org> | 2014-07-05 06:51:13 +0200 |
commit | c7b3be97d96ee5a17bb88dceec42c57e9bf69c5d (patch) | |
tree | 299ca6f39df74380a74102a55c7f5ae933fb174a /ctdb/server/ctdb_daemon.c | |
parent | 085c7a71fde37cb2a67a4c67673cd22f8acf0861 (diff) | |
download | samba-c7b3be97d96ee5a17bb88dceec42c57e9bf69c5d.tar.gz |
ctdb-daemon: Exit if setting the session ID fails
Currently ctdbd_wrapper depends on the session ID. Very soon PID file
removal will too. :-)
Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
Diffstat (limited to 'ctdb/server/ctdb_daemon.c')
-rw-r--r-- | ctdb/server/ctdb_daemon.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/ctdb/server/ctdb_daemon.c b/ctdb/server/ctdb_daemon.c index 391f2444f91..eb42e18886c 100644 --- a/ctdb/server/ctdb_daemon.c +++ b/ctdb/server/ctdb_daemon.c @@ -1162,7 +1162,9 @@ int ctdb_start_daemon(struct ctdb_context *ctdb, bool do_fork, bool use_syslog) tdb_reopen_all(false); if (do_fork) { - setsid(); + if (setsid() == -1) { + ctdb_die(ctdb, "Failed to setsid()\n"); + } close(0); if (open("/dev/null", O_RDONLY) != 0) { DEBUG(DEBUG_ALERT,(__location__ " Failed to setup stdin on /dev/null\n")); |