[PATCH 4/4] net: resolv: Make argument const
Sascha Hauer
s.hauer at pengutronix.de
Mon Dec 14 02:41:14 PST 2015
resolv() is not allowed to change the hostname argument, make it const.
Signed-off-by: Sascha Hauer <s.hauer at pengutronix.de>
---
include/net.h | 4 ++--
net/dns.c | 4 ++--
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/include/net.h b/include/net.h
index 2a37a43..13e335a 100644
--- a/include/net.h
+++ b/include/net.h
@@ -315,9 +315,9 @@ int string_to_ethaddr(const char *str, u8 enetaddr[6]);
void ethaddr_to_string(const u8 enetaddr[6], char *str);
#ifdef CONFIG_NET_RESOLV
-IPaddr_t resolv(char *host);
+IPaddr_t resolv(const char *host);
#else
-static inline IPaddr_t resolv(char *host)
+static inline IPaddr_t resolv(const char *host)
{
IPaddr_t ip = 0;
string_to_ip(host, &ip);
diff --git a/net/dns.c b/net/dns.c
index 0e16ea2..5488e9f 100644
--- a/net/dns.c
+++ b/net/dns.c
@@ -59,7 +59,7 @@ static uint64_t dns_timer_start;
static int dns_state;
static IPaddr_t dns_ip;
-static int dns_send(char *name)
+static int dns_send(const char *name)
{
int ret;
struct header *header;
@@ -199,7 +199,7 @@ static void dns_handler(void *ctx, char *packet, unsigned len)
net_eth_to_udplen(packet));
}
-IPaddr_t resolv(char *host)
+IPaddr_t resolv(const char *host)
{
IPaddr_t ip;
const char *ns;
--
2.6.2
More information about the barebox
mailing list