Browse Source

[core] remove unused arg to fdevent_fcntl_set_nb*

personal/stbuehler/ci-build
Glenn Strauss 2 years ago
parent
commit
48004c6a7c
  1. 17
      src/fdevent.c
  2. 6
      src/fdevent.h
  3. 6
      src/mod_cgi.c
  4. 4
      src/network.c
  5. 4
      src/server.c

17
src/fdevent.c

@ -466,8 +466,7 @@ void fdevent_clrfd_cloexec(int fd) {
#endif
}
int fdevent_fcntl_set_nb(fdevents *ev, int fd) {
UNUSED(ev);
int fdevent_fcntl_set_nb(int fd) {
#ifdef O_NONBLOCK
return fcntl(fd, F_SETFL, O_NONBLOCK | O_RDWR);
#else
@ -476,17 +475,17 @@ int fdevent_fcntl_set_nb(fdevents *ev, int fd) {
#endif
}
int fdevent_fcntl_set_nb_cloexec(fdevents *ev, int fd) {
int fdevent_fcntl_set_nb_cloexec(int fd) {
fdevent_setfd_cloexec(fd);
return fdevent_fcntl_set_nb(ev, fd);
return fdevent_fcntl_set_nb(fd);
}
int fdevent_fcntl_set_nb_cloexec_sock(fdevents *ev, int fd) {
int fdevent_fcntl_set_nb_cloexec_sock(int fd) {
#if defined(SOCK_CLOEXEC) && defined(SOCK_NONBLOCK)
if (use_sock_cloexec && use_sock_nonblock)
return 0;
#endif
return fdevent_fcntl_set_nb_cloexec(ev, fd);
return fdevent_fcntl_set_nb_cloexec(fd);
}
int fdevent_socket_cloexec(int domain, int type, int protocol) {
@ -632,7 +631,7 @@ int fdevent_accept_listenfd(int listenfd, struct sockaddr *addr, size_t *addrlen
fd = accept4(listenfd, addr, &len, SOCK_CLOEXEC | SOCK_NONBLOCK);
if (fd >= 0) {
if (!use_sock_nonblock) {
if (0 != fdevent_fcntl_set_nb(NULL, fd)) {
if (0 != fdevent_fcntl_set_nb(fd)) {
close(fd);
fd = -1;
}
@ -662,7 +661,7 @@ int fdevent_accept_listenfd(int listenfd, struct sockaddr *addr, size_t *addrlen
if (fd >= 0) {
*addrlen = (size_t)len;
if (!sock_cloexec && 0 != fdevent_fcntl_set_nb_cloexec(NULL, fd)) {
if (!sock_cloexec && 0 != fdevent_fcntl_set_nb_cloexec(fd)) {
close(fd);
fd = -1;
}
@ -944,7 +943,7 @@ static int fdevent_open_logger_pipe(const char *logger) {
fdevent_setfd_cloexec(fds[0]);
fdevent_setfd_cloexec(fds[1]);
/*(nonblocking write() from lighttpd)*/
if (0 != fdevent_fcntl_set_nb(NULL, fds[1])) { /*(ignore)*/ }
if (0 != fdevent_fcntl_set_nb(fds[1])) { /*(ignore)*/ }
pid = fdevent_open_logger_pipe_spawn(logger, fds[0]);

6
src/fdevent.h

@ -74,9 +74,9 @@ void fdevent_sched_close(fdevents *ev, int fd, int issock);
void fdevent_setfd_cloexec(int fd);
void fdevent_clrfd_cloexec(int fd);
int fdevent_fcntl_set_nb(fdevents *ev, int fd);
int fdevent_fcntl_set_nb_cloexec(fdevents *ev, int fd);
int fdevent_fcntl_set_nb_cloexec_sock(fdevents *ev, int fd);
int fdevent_fcntl_set_nb(int fd);
int fdevent_fcntl_set_nb_cloexec(int fd);
int fdevent_fcntl_set_nb_cloexec_sock(int fd);
int fdevent_socket_cloexec(int domain, int type, int protocol);
int fdevent_socket_nb_cloexec(int domain, int type, int protocol);
int fdevent_open_cloexec(const char *pathname, int symlinks, int flags, mode_t mode);

6
src/mod_cgi.c

@ -842,13 +842,12 @@ static int cgi_create_env(connection *con, plugin_data *p, handler_ctx *hctx, bu
cgi_pid_add(p, hctx->pid, hctx);
++con->srv->cur_fds;
struct fdevents * const ev = con->srv->ev;
if (0 == con->request.content_length) {
close(to_cgi_fds[1]);
} else {
/* there is content to send */
if (-1 == fdevent_fcntl_set_nb(ev, to_cgi_fds[1])) {
if (-1 == fdevent_fcntl_set_nb(to_cgi_fds[1])) {
log_perror(con->conf.errh, __FILE__, __LINE__, "fcntl failed");
close(to_cgi_fds[1]);
cgi_connection_close(con, hctx);
@ -864,8 +863,9 @@ static int cgi_create_env(connection *con, plugin_data *p, handler_ctx *hctx, bu
++con->srv->cur_fds;
}
struct fdevents * const ev = con->srv->ev;
hctx->fdn = fdevent_register(ev, hctx->fd, cgi_handle_fdevent, hctx);
if (-1 == fdevent_fcntl_set_nb(ev, hctx->fd)) {
if (-1 == fdevent_fcntl_set_nb(hctx->fd)) {
log_perror(con->conf.errh, __FILE__, __LINE__, "fcntl failed");
cgi_connection_close(con, hctx);
return -1;

4
src/network.c

@ -287,7 +287,7 @@ static int network_server_init(server *srv, network_socket_config *s, buffer *ho
if (-1 != stdin_fd) {
srv_socket->fd = stdin_fd;
if (-1 == fdevent_fcntl_set_nb_cloexec(srv->ev, stdin_fd)) {
if (-1 == fdevent_fcntl_set_nb_cloexec(stdin_fd)) {
log_perror(srv->errh, __FILE__, __LINE__, "fcntl");
return -1;
}
@ -319,7 +319,7 @@ static int network_server_init(server *srv, network_socket_config *s, buffer *ho
return -1;
}
if (-1 == fdevent_fcntl_set_nb(srv->ev, srv_socket->fd)) {
if (-1 == fdevent_fcntl_set_nb(srv_socket->fd)) {
log_perror(srv->errh, __FILE__, __LINE__, "fcntl");
return -1;
}

4
src/server.c

@ -378,7 +378,7 @@ static int server_oneshot_init(server *srv, int fd) {
}
/*(must set flags; fd did not pass through fdevent accept() logic)*/
if (-1 == fdevent_fcntl_set_nb_cloexec(srv->ev, fd)) {
if (-1 == fdevent_fcntl_set_nb_cloexec(fd)) {
log_perror(srv->errh, __FILE__, __LINE__, "fcntl()");
return 0;
}
@ -550,7 +550,7 @@ static int server_sockets_set_nb_cloexec (server *srv) {
if (srv->sockets_disabled) return 0; /* lighttpd -1 (one-shot mode) */
for (uint32_t i = 0; i < srv->srv_sockets.used; ++i) {
server_socket *srv_socket = srv->srv_sockets.ptr[i];
if (-1 == fdevent_fcntl_set_nb_cloexec_sock(srv->ev, srv_socket->fd)) {
if (-1 == fdevent_fcntl_set_nb_cloexec_sock(srv_socket->fd)) {
log_perror(srv->errh, __FILE__, __LINE__, "fcntl()");
return -1;
}

Loading…
Cancel
Save