aboutsummaryrefslogtreecommitdiff
path: root/lib/init/init_socket_create.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/init/init_socket_create.c')
-rw-r--r--lib/init/init_socket_create.c35
1 files changed, 0 insertions, 35 deletions
diff --git a/lib/init/init_socket_create.c b/lib/init/init_socket_create.c
deleted file mode 100644
index 82a528c..0000000
--- a/lib/init/init_socket_create.c
+++ /dev/null
@@ -1,35 +0,0 @@
-/* SPDX-License-Identifier: ISC */
-#include <sys/socket.h>
-#include <sys/un.h>
-#include <unistd.h>
-#include <string.h>
-#include <stdio.h>
-
-#include "initsock.h"
-
-int init_socket_create(void)
-{
- struct sockaddr_un un;
- int fd;
-
- fd = socket(AF_UNIX, SOCK_DGRAM | SOCK_CLOEXEC, 0);
- if (fd < 0) {
- perror("socket");
- return -1;
- }
-
- memset(&un, 0, sizeof(un));
- un.sun_family = AF_UNIX;
-
- strcpy(un.sun_path, INIT_SOCK_PATH);
- unlink(INIT_SOCK_PATH);
-
- if (bind(fd, (struct sockaddr *)&un, sizeof(un))) {
- perror("bind: " INIT_SOCK_PATH);
- close(fd);
- unlink(INIT_SOCK_PATH);
- return -1;
- }
-
- return fd;
-}