checked O_CLOEXEC availablity
This commit is contained in:
parent
f575bc6add
commit
b845bee716
@ -407,7 +407,7 @@ static HCL_INLINE int open_input (hcl_t* hcl, hcl_ioinarg_t* arg)
|
|||||||
#if defined(HCL_OOCH_IS_UCH)
|
#if defined(HCL_OOCH_IS_UCH)
|
||||||
hcl_convootobcstr (hcl, server->cfg.script_include_path, &ucslen, bb->fn, &parlen);
|
hcl_convootobcstr (hcl, server->cfg.script_include_path, &ucslen, bb->fn, &parlen);
|
||||||
#else
|
#else
|
||||||
hcl_copybchars (bb->fn, fn, server->cfg.script_include_path);
|
hcl_copybchars (bb->fn, server->cfg.script_include_path, parlen);
|
||||||
#endif
|
#endif
|
||||||
if (!IS_PATH_SEP(bb->fn[parlen])) bb->fn[parlen++] = PATH_SEP_CHAR; /* +2 was used in hcl_callocmem() for this (+1 for this, +1 for '\0' */
|
if (!IS_PATH_SEP(bb->fn[parlen])) bb->fn[parlen++] = PATH_SEP_CHAR; /* +2 was used in hcl_callocmem() for this (+1 for this, +1 for '\0' */
|
||||||
}
|
}
|
||||||
@ -2314,8 +2314,10 @@ static int setup_listeners (hcl_server_t* server, const hcl_bch_t* addrs)
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if defined(O_CLOEXEC)
|
||||||
fcv = fcntl(ep_fd, F_GETFD, 0);
|
fcv = fcntl(ep_fd, F_GETFD, 0);
|
||||||
if (fcv >= 0) fcntl(ep_fd, F_SETFD, fcv | O_CLOEXEC);
|
if (fcv >= 0) fcntl(ep_fd, F_SETFD, fcv | O_CLOEXEC);
|
||||||
|
#endif
|
||||||
|
|
||||||
HCL_MEMSET (&ev, 0, HCL_SIZEOF(ev));
|
HCL_MEMSET (&ev, 0, HCL_SIZEOF(ev));
|
||||||
ev.events = EPOLLIN | EPOLLHUP | EPOLLERR;
|
ev.events = EPOLLIN | EPOLLHUP | EPOLLERR;
|
||||||
@ -2361,8 +2363,10 @@ static int setup_listeners (hcl_server_t* server, const hcl_bch_t* addrs)
|
|||||||
optval = 1;
|
optval = 1;
|
||||||
setsockopt (srv_fd, SOL_SOCKET, SO_REUSEADDR, &optval, HCL_SIZEOF(int));
|
setsockopt (srv_fd, SOL_SOCKET, SO_REUSEADDR, &optval, HCL_SIZEOF(int));
|
||||||
|
|
||||||
|
#if defined(O_CLOEXEC)
|
||||||
fcv = fcntl(srv_fd, F_GETFD, 0);
|
fcv = fcntl(srv_fd, F_GETFD, 0);
|
||||||
if (fcv >= 0) fcntl(srv_fd, F_SETFD, fcv | O_CLOEXEC);
|
if (fcv >= 0) fcntl(srv_fd, F_SETFD, fcv | O_CLOEXEC);
|
||||||
|
#endif
|
||||||
|
|
||||||
if (bind(srv_fd, (struct sockaddr*)&srv_addr, srv_len) == -1)
|
if (bind(srv_fd, (struct sockaddr*)&srv_addr, srv_len) == -1)
|
||||||
{
|
{
|
||||||
@ -2494,8 +2498,10 @@ int hcl_server_start (hcl_server_t* server, const hcl_bch_t* addrs)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if defined(O_CLOEXEC)
|
||||||
fcv = fcntl(cli_fd, F_GETFD, 0);
|
fcv = fcntl(cli_fd, F_GETFD, 0);
|
||||||
if (fcv >= 0) fcntl(cli_fd, F_SETFD, fcv | O_CLOEXEC);
|
if (fcv >= 0) fcntl(cli_fd, F_SETFD, fcv | O_CLOEXEC);
|
||||||
|
#endif
|
||||||
|
|
||||||
if (server->cfg.worker_max_count > 0)
|
if (server->cfg.worker_max_count > 0)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user