Skip to content

Commit 5c4c9c6

Browse files
committed
Remove potential unneeded string operations
1 parent 045ae20 commit 5c4c9c6

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

sapi/fpm/fpm/fpm_unix.c

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -66,19 +66,23 @@ static struct passwd *fpm_unix_get_passwd(struct fpm_worker_pool_s *wp, const ch
6666

6767
static inline bool fpm_unix_check_listen_address(struct fpm_worker_pool_s *wp, const char *address, int flags)
6868
{
69-
struct sockaddr_un test_socket;
70-
size_t address_length = strlen(address);
71-
size_t socket_length = sizeof(test_socket.sun_path);
72-
7369
if (wp->listen_address_domain != FPM_AF_UNIX) {
7470
return true;
7571
}
7672

73+
struct sockaddr_un test_socket;
74+
size_t address_length = strlen(address);
75+
size_t socket_length = sizeof(test_socket.sun_path);
76+
7777
if (address_length < socket_length) {
7878
return true;
7979
}
8080

81-
zlog(flags, "[pool %s] cannot bind to UNIX socket '%s' as path is too long (found length: %lu, maximal length: %lu)", wp->config->name, address, address_length, socket_length);
81+
zlog(
82+
flags,
83+
"[pool %s] cannot bind to UNIX socket '%s' as path is too long (found length: %lu, maximal length: %lu)",
84+
wp->config->name, address, address_length, socket_length
85+
);
8286

8387
return false;
8488
}

0 commit comments

Comments
 (0)