1
0
mirror of https://github.com/samba-team/samba.git synced 2025-03-05 20:58:40 +03:00

ctdb-daemon: Use sock_clean() to remove stale sockets

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>

Autobuild-User(master): Martin Schwenke <martins@samba.org>
Autobuild-Date(master): Fri Feb 17 14:45:10 CET 2017 on sn-devel-144
This commit is contained in:
Amitay Isaacs 2017-01-30 14:34:12 +11:00 committed by Martin Schwenke
parent a0c22958c5
commit 2458752fd0
2 changed files with 3 additions and 14 deletions

View File

@ -45,6 +45,7 @@
#include "common/common.h"
#include "common/logging.h"
#include "common/pidfile.h"
#include "common/sock_io.h"
struct ctdb_client_pid_list {
struct ctdb_client_pid_list *next, *prev;
@ -1007,14 +1008,7 @@ static int ux_socket_bind(struct ctdb_context *ctdb)
addr.sun_family = AF_UNIX;
strncpy(addr.sun_path, ctdb->daemon.name, sizeof(addr.sun_path)-1);
/* Remove any old socket */
ret = unlink(ctdb->daemon.name);
if (ret == 0) {
DEBUG(DEBUG_WARNING,
("Removed stale socket %s\n", ctdb->daemon.name));
} else if (errno != ENOENT) {
DEBUG(DEBUG_ERR,
("Failed to remove stale socket %s\n", ctdb->daemon.name));
if (! sock_clean(ctdb->daemon.name)) {
return -1;
}

View File

@ -171,12 +171,7 @@ int ctdb_start_eventd(struct ctdb_context *ctdb)
ectx = ctdb->ectx;
ret = unlink(ectx->socket);
if (ret == 0) {
D_WARNING("Removed stale eventd socket %s\n", ectx->socket);
} else if (errno != ENOENT) {
D_ERR("Failed to remove stale eventd socket %s\n",
ectx->socket);
if (! sock_clean(ectx->socket)) {
return -1;
}