diff options
author | June McEnroe <june@causal.agency> | 2020-11-14 11:47:26 -0500 |
---|---|---|
committer | June McEnroe <june@causal.agency> | 2020-11-14 11:47:26 -0500 |
commit | 70c3c9156a64c9053978e499328a121757628ed2 (patch) | |
tree | 978a97afca4539be291cd6aec5e8df20e5f44e6b /local.c | |
parent | Only send shutdown QUIT and ERROR to registered clients (diff) | |
download | pounce-70c3c9156a64c9053978e499328a121757628ed2.tar.gz pounce-70c3c9156a64c9053978e499328a121757628ed2.zip |
Swap localAccept parameter order
Diffstat (limited to '')
-rw-r--r-- | local.c | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/local.c b/local.c index a697e15..21e7cb1 100644 --- a/local.c +++ b/local.c @@ -221,29 +221,29 @@ static int recvfd(int sock) { return *(int *)CMSG_DATA(cmsg); } -struct tls *localAccept(int *fd, int bind) { - *fd = accept(bind, NULL, NULL); - if (*fd < 0) return NULL; +int localAccept(struct tls **client, int bind) { + int fd = accept(bind, NULL, NULL); + if (fd < 0) return fd; if (unix) { - int sent = recvfd(*fd); + int sent = recvfd(fd); if (sent < 0) err(EX_IOERR, "recvfd"); - close(*fd); - *fd = sent; + close(fd); + fd = sent; } int on = 1; - int error = setsockopt(*fd, SOL_SOCKET, SO_KEEPALIVE, &on, sizeof(on)); + int error = setsockopt(fd, SOL_SOCKET, SO_KEEPALIVE, &on, sizeof(on)); if (error) err(EX_OSERR, "setsockopt"); #ifdef TCP_KEEPIDLE int idle = 15 * 60; - error = setsockopt(*fd, IPPROTO_TCP, TCP_KEEPIDLE, &idle, sizeof(idle)); + error = setsockopt(fd, IPPROTO_TCP, TCP_KEEPIDLE, &idle, sizeof(idle)); if (error) err(EX_OSERR, "setsockopt"); #endif - struct tls *client; - error = tls_accept_socket(server, &client, *fd); + error = tls_accept_socket(server, client, fd); if (error) errx(EX_SOFTWARE, "tls_accept_socket: %s", tls_error(server)); - return client; + + return fd; } |