From 243278fd360fb291a43a8ed2c8bed75d81e69660 Mon Sep 17 00:00:00 2001 From: "C. McEnroe" Date: Tue, 5 Oct 2021 22:10:59 -0400 Subject: Delete local-path socket like normal --- bounce.c | 1 + local.c | 24 ------------------------ 2 files changed, 1 insertion(+), 24 deletions(-) diff --git a/bounce.c b/bounce.c index beab2bc..2548626 100644 --- a/bounce.c +++ b/bounce.c @@ -530,6 +530,7 @@ int main(int argc, char *argv[]) { } clientFree(client); } + if (bindPath[0]) unlink(bindPath); } #ifdef __OpenBSD__ diff --git a/local.c b/local.c index 954c015..4f0cc5e 100644 --- a/local.c +++ b/local.c @@ -27,14 +27,11 @@ #include #include -#include -#include #include #include #include #include #include -#include #include #include #include @@ -141,13 +138,6 @@ size_t localBind(int fds[], size_t cap, const char *host, const char *port) { } static bool unix; -static int unixDir = -1; -static char unixFile[PATH_MAX]; - -static void unixUnlink(void) { - int error = unlinkat(unixDir, unixFile, 0); - if (error) warn("unlinkat"); -} static int unixBind(int sock, const char *path) { struct sockaddr_un addr = { .sun_family = AF_UNIX }; @@ -182,20 +172,6 @@ size_t localUnix(int fds[], size_t cap, const char *path) { int error = unixBind(sock, path); if (error) err(EX_UNAVAILABLE, "%s", path); - char dir[PATH_MAX] = "."; - const char *base = strrchr(path, '/'); - if (base) { - snprintf(dir, sizeof(dir), "%.*s", (int)(base - path), path); - base++; - } else { - base = path; - } - snprintf(unixFile, sizeof(unixFile), "%s", base); - - unixDir = open(dir, O_DIRECTORY); - if (unixDir < 0) err(EX_UNAVAILABLE, "%s", dir); - atexit(unixUnlink); - unix = true; fds[0] = sock; return 1; -- cgit 1.4.1