From f21612d73f8f75c5b4dd2a496865dfdd30165c54 Mon Sep 17 00:00:00 2001 From: Urban Wallasch Date: Fri, 25 Oct 2019 17:32:08 +0200 Subject: [PATCH] * net: constify buffer argument of send_to(); #include stdlib.h; fixed comment --- net/net.c | 4 ++-- net/net.h | 4 +++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/net/net.c b/net/net.c index 0b048bf..296155e 100644 --- a/net/net.c +++ b/net/net.c @@ -14,6 +14,7 @@ #include #include +#include #include #include #include @@ -37,7 +38,6 @@ #endif #ifdef NET_ERR -#include /* Log helper function: create "host:port" string from socket address: */ static char *addr2str(const struct sockaddr *addr, socklen_t addrlen, @@ -354,7 +354,7 @@ ssize_t recvfrom_tm(int fd, void *buf, size_t len, int flags, } /* Write to socket or file descriptor: */ -ssize_t sendto_tm(int fd, void *buf, size_t len, int flags, +ssize_t sendto_tm(int fd, const void *buf, size_t len, int flags, const struct sockaddr *addr, socklen_t alen, int timeout) { ssize_t r; struct pollfd pfd; diff --git a/net/net.h b/net/net.h index 0a793fe..a57f50b 100644 --- a/net/net.h +++ b/net/net.h @@ -27,6 +27,8 @@ * send_tm * write_tm - functions and macros to write with timeout * + * sendfile_tm - copy data from one file descriptor to another + * */ #ifndef NET_H_ @@ -217,7 +219,7 @@ extern ssize_t recvfrom_tm(int fd, void *buf, size_t len, int flags, * flags, addr and alen are ignored, and performance may be slightly * inferior compared to a plain write() call. */ -extern ssize_t sendto_tm(int fd, void *buf, size_t len, int flags, +extern ssize_t sendto_tm(int fd, const void *buf, size_t len, int flags, const struct sockaddr *addr, socklen_t alen, int timeout); /* * Shorthand macros to closely match send() and write() prototypes: -- 2.30.2