Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
#include "common/logging.h"
#include "common/sock_io.h"
+bool sock_clean(const char *sockpath)
+{
+ int ret;
+
+ ret = unlink(sockpath);
+ if (ret == 0) {
+ D_WARNING("Removed stale socket %s\n", sockpath);
+ } else if (errno != ENOENT) {
+ D_ERR("Failed to remove stale socket %s\n", sockpath);
+ return false;
+ }
+
+ return true;
+}
+
int sock_connect(const char *sockpath)
{
struct sockaddr_un addr;
struct sock_queue;
+bool sock_clean(const char *sockpath);
int sock_connect(const char *sockpath);
struct sock_queue *sock_queue_setup(TALLOC_CTX *mem_ctx,