summaryrefslogtreecommitdiff
path: root/manual
diff options
context:
space:
mode:
authorCollin Funk <collin.funk1@gmail.com>2025-09-28 15:34:20 -0700
committerCollin Funk <collin.funk1@gmail.com>2025-09-29 17:01:54 -0700
commit1c539d79f6712a90613f898d43b620c7ae1d00fc (patch)
treeaf3789a254fb6d8835c75c017193018042e974e5 /manual
parente465aeed597ed504edf88183ec8ccf31fd5b0c56 (diff)
manual: Fix compiler errors in inetsrv example.
Previously this file failed to compile with the following errors: $ gcc manual/examples/inetsrv.c manual/examples/inetsrv.c: In function ‘main’: manual/examples/inetsrv.c:97:31: error: passing argument 3 of ‘accept’ from incompatible pointer type [-Wincompatible-pointer-types] 97 | &size); | ^~~~~ | | | size_t * {aka long unsigned int *} In file included from manual/examples/inetsrv.c:23: /usr/include/sys/socket.h:307:42: note: expected ‘socklen_t * restrict’ {aka ‘unsigned int * restrict’} but argument is of type ‘size_t *’ {aka ‘long unsigned int *’} 307 | socklen_t *__restrict __addr_len); | ~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~ manual/examples/inetsrv.c:105:26: error: implicit declaration of function ‘inet_ntoa’ [-Wimplicit-function-declaration] 105 | inet_ntoa (clientname.sin_addr), Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Diffstat (limited to 'manual')
-rw-r--r--manual/examples/inetsrv.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/manual/examples/inetsrv.c b/manual/examples/inetsrv.c
index 003a951473..b854fe6722 100644
--- a/manual/examples/inetsrv.c
+++ b/manual/examples/inetsrv.c
@@ -15,6 +15,7 @@
along with this program; if not, see <https://www.gnu.org/licenses/>.
*/
+#include <arpa/inet.h>
#include <stdio.h>
#include <errno.h>
#include <stdlib.h>
@@ -59,7 +60,7 @@ main (void)
fd_set active_fd_set, read_fd_set;
int i;
struct sockaddr_in clientname;
- size_t size;
+ socklen_t size;
/* Create the socket and set it up to accept connections. */
sock = make_socket (PORT);