diff options
author | June McEnroe <june@causal.agency> | 2021-10-05 22:10:59 -0400 |
---|---|---|
committer | June McEnroe <june@causal.agency> | 2021-10-05 22:10:59 -0400 |
commit | 243278fd360fb291a43a8ed2c8bed75d81e69660 (patch) | |
tree | ab55110fe9c5a4b22d6e9ea13eaafa41ba07ad45 | |
parent | FreeBSD: Remove capsicum support (diff) | |
download | pounce-243278fd360fb291a43a8ed2c8bed75d81e69660.tar.gz pounce-243278fd360fb291a43a8ed2c8bed75d81e69660.zip |
Delete local-path socket like normal
Diffstat (limited to '')
-rw-r--r-- | bounce.c | 1 | ||||
-rw-r--r-- | local.c | 24 |
2 files changed, 1 insertions, 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 <err.h> #include <errno.h> -#include <fcntl.h> -#include <limits.h> #include <netdb.h> #include <netinet/in.h> #include <stdbool.h> #include <stdio.h> #include <stdlib.h> -#include <string.h> #include <sys/socket.h> #include <sys/stat.h> #include <sys/un.h> @@ -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; |