fix pedantic usage address_len parameter in accept(2) - geomyidae - A small C-based gopherd. HTML git clone git://bitreich.org/geomyidae/ git://enlrupgkhuxnvlhsf6lc3fziv5h2hhfrinws65d7roiv6bfj7d652fid.onion/geomyidae/ DIR Log DIR Files DIR Refs DIR Tags DIR README DIR LICENSE --- DIR commit f02d57cfae2c18951b665353b21aed02d29731a9 DIR parent cb9b6b70dbc6b33cc29364ba31023ffeb0579085 HTML Author: Hiltjo Posthuma <hiltjo@codemadness.org> Date: Wed, 29 Aug 2018 20:22:19 +0200 fix pedantic usage address_len parameter in accept(2) POSIX says regarding `address_len`: "on input specifies the length of the supplied sockaddr structure, and on output specifies the length of the stored address." So it should be set to the sizeof the used structure. Signed-off-by: Christoph Lohmann <20h@r-36.net> Diffstat: M main.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) --- DIR diff --git a/main.c b/main.c @@ -533,8 +533,6 @@ main(int argc, char *argv[]) initsignals(); - cltlen = sizeof(clt); - #ifdef __OpenBSD__ char promises[31]; /* check the size needed in the fork too */ snprintf(promises, sizeof(promises), "rpath inet stdio proc exec %s", @@ -546,6 +544,7 @@ main(int argc, char *argv[]) #endif /* __OpenBSD__ */ while (1) { + cltlen = sizeof(clt); sock = accept(listfd, (struct sockaddr *)&clt, &cltlen); if (sock < 0) { switch (errno) {