diff options
Diffstat (limited to 'src/socket.c')
-rw-r--r-- | src/socket.c | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/src/socket.c b/src/socket.c index 7510a6d6de..d0568c9b52 100644 --- a/src/socket.c +++ b/src/socket.c @@ -724,15 +724,10 @@ static int socket_open_fds(Socket *s) { SocketPort *p; int r; char *label = NULL; + bool know_label = false; assert(s); - if ((r = socket_instantiate_service(s)) < 0) - return r; - - if ((r = label_get_socket_label_from_exe(s->service->exec_command[SERVICE_EXEC_START]->path, &label)) < 0) - return r; - LIST_FOREACH(port, p, s->ports) { if (p->fd >= 0) @@ -740,6 +735,17 @@ static int socket_open_fds(Socket *s) { if (p->type == SOCKET_SOCKET) { + if (!know_label) { + + if ((r = socket_instantiate_service(s)) < 0) + return r; + + if ((r = label_get_socket_label_from_exe(s->service->exec_command[SERVICE_EXEC_START]->path, &label)) < 0) + return r; + + know_label = true; + } + if ((r = socket_address_listen( &p->address, s->backlog, @@ -760,7 +766,6 @@ static int socket_open_fds(Socket *s) { p->path, s->directory_mode, s->socket_mode, - label, &p->fd)) < 0) goto rollback; |