hfingerd

hhvn.uk:79
Log | Files | Refs | LICENSE

commit 7e42b0ad6af11d06299e309dbc5b9ffd50c6bf49
parent f3b63907979ae38706562db3924ceed757da393a
Author: hhvn <dev@hhvn.uk>
Date:   Sun,  6 Jun 2021 17:59:49 +0100

main.c: accept() working on openbsd

Diffstat:
Mmain.c | 7+++++--
1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/main.c b/main.c @@ -141,8 +141,10 @@ sighandler(int signal) { int main(int argc, char *argv[]) { - struct sockaddr *addr; + struct sockaddr_storage addr; struct addrinfo hints; + char promises[512]; + socklen_t addrlen; int sock, handle; int serrno; pid_t pid; @@ -183,7 +185,8 @@ main(int argc, char *argv[]) { signal(SIGCHLD, sighandler); for (;;) { - if ((handle = accept(sock, addr, (socklen_t *)sizeof(struct sockaddr))) == -1) + addrlen = sizeof(addr); + if ((handle = accept(sock, (struct sockaddr *)&addr, &addrlen)) == -1) die(1, "accept(): %s\n", strerror(errno)); verbose("Accepted client with handle %d\n", handle);