mirror of
https://github.com/samba-team/samba.git
synced 2025-02-26 21:57:41 +03:00
ctdb-daemon: Bind to Unix domain socket after PID file creation
No use touching the socket if PID file creation fails. BUG: https://bugzilla.samba.org/show_bug.cgi?id=12287 Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com> (cherry picked from commit 1e501c77492d25b760c7b10849460ee6490f39dc)
This commit is contained in:
parent
81d8f89385
commit
2ebed563e4
@ -1227,13 +1227,6 @@ int ctdb_start_daemon(struct ctdb_context *ctdb, bool do_fork)
|
||||
int res, ret = -1;
|
||||
struct tevent_fd *fde;
|
||||
|
||||
/* create a unix domain stream socket to listen to */
|
||||
res = ux_socket_bind(ctdb);
|
||||
if (res!=0) {
|
||||
DEBUG(DEBUG_ALERT,("Cannot continue. Exiting!\n"));
|
||||
exit(10);
|
||||
}
|
||||
|
||||
if (do_fork && fork()) {
|
||||
return 0;
|
||||
}
|
||||
@ -1258,6 +1251,13 @@ int ctdb_start_daemon(struct ctdb_context *ctdb, bool do_fork)
|
||||
CTDB_VERSION_STRING, ctdb->ctdbd_pid));
|
||||
ctdb_create_pidfile(ctdb);
|
||||
|
||||
/* create a unix domain stream socket to listen to */
|
||||
res = ux_socket_bind(ctdb);
|
||||
if (res!=0) {
|
||||
DEBUG(DEBUG_ALERT,("Cannot continue. Exiting!\n"));
|
||||
exit(10);
|
||||
}
|
||||
|
||||
/* Make sure we log something when the daemon terminates.
|
||||
* This must be the first exit handler to run (so the last to
|
||||
* be registered.
|
||||
|
Loading…
x
Reference in New Issue
Block a user