Introduction
Introduction Statistics Contact Development Disclaimer Help
fix pedantic usage address_len parameter in accept(2) - geomyidae - A small C-b…
git clone git://bitreich.org/geomyidae/ git://enlrupgkhuxnvlhsf6lc3fziv5h2hhfri…
Log
Files
Refs
Tags
README
LICENSE
---
commit f02d57cfae2c18951b665353b21aed02d29731a9
parent cb9b6b70dbc6b33cc29364ba31023ffeb0579085
Author: Hiltjo Posthuma <[email protected]>
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 <[email protected]>
Diffstat:
M main.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
---
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) {
You are viewing proxied material from bitreich.org. The copyright of proxied material belongs to its original authors. Any comments or complaints in relation to proxied material should be directed to the original authors of the content concerned. Please see the disclaimer for more details.