summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--src/nxt_main_process.c8
-rw-r--r--src/nxt_runtime.c17
2 files changed, 23 insertions, 2 deletions
diff --git a/src/nxt_main_process.c b/src/nxt_main_process.c
index 4c89121e..7548be9a 100644
--- a/src/nxt_main_process.c
+++ b/src/nxt_main_process.c
@@ -1182,8 +1182,9 @@ nxt_main_listening_socket(nxt_sockaddr_t *sa, nxt_listening_socket_t *ls)
if (sa->u.sockaddr.sa_family == AF_UNIX
&& sa->u.sockaddr_un.sun_path[0] != '\0')
{
- char *filename;
- mode_t access;
+ char *filename;
+ mode_t access;
+ nxt_thread_t *thr;
filename = sa->u.sockaddr_un.sun_path;
access = (S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH);
@@ -1194,6 +1195,9 @@ nxt_main_listening_socket(nxt_sockaddr_t *sa, nxt_listening_socket_t *ls)
filename, nxt_errno);
goto fail;
}
+
+ thr = nxt_thread();
+ nxt_runtime_listen_socket_add(thr->runtime, sa);
}
#endif
diff --git a/src/nxt_runtime.c b/src/nxt_runtime.c
index cb5fe421..739238af 100644
--- a/src/nxt_runtime.c
+++ b/src/nxt_runtime.c
@@ -563,6 +563,7 @@ nxt_runtime_exit(nxt_task_t *task, void *obj, void *data)
#if (NXT_HAVE_UNIX_DOMAIN)
{
+ size_t i;
nxt_sockaddr_t *sa;
nxt_file_name_t *name;
@@ -572,6 +573,22 @@ nxt_runtime_exit(nxt_task_t *task, void *obj, void *data)
name = (nxt_file_name_t *) sa->u.sockaddr_un.sun_path;
(void) nxt_file_delete(name);
}
+
+ for (i = 0; i < rt->listen_sockets->nelts; i++) {
+ nxt_listen_socket_t *ls;
+
+ ls = (nxt_listen_socket_t *) rt->listen_sockets->elts + i;
+ sa = ls->sockaddr;
+
+ if (sa->u.sockaddr.sa_family != AF_UNIX
+ || sa->u.sockaddr_un.sun_path[0] == '\0')
+ {
+ continue;
+ }
+
+ name = (nxt_file_name_t *) sa->u.sockaddr_un.sun_path;
+ (void) nxt_file_delete(name);
+ }
}
#endif
}