From e5eed18cf4e8ef959d1c479c31632411209ddba4 Mon Sep 17 00:00:00 2001 From: Jonas 'Sortie' Termansen Date: Fri, 1 Jul 2016 19:39:06 +0200 Subject: [PATCH] Deprecate inet_addr(3) and inet_ntoa(3). --- doc/obsolete-stuff | 21 +++++++++++++++++++++ libc/include/arpa/inet.h | 2 ++ 2 files changed, 23 insertions(+) diff --git a/doc/obsolete-stuff b/doc/obsolete-stuff index 73a63a63..177ab57d 100644 --- a/doc/obsolete-stuff +++ b/doc/obsolete-stuff @@ -149,6 +149,27 @@ This function is rather pointless. If we use a character encoding that wasn't ascii compatible, then it doesn't make sense. If we use a sane character encoding such as UTF-8, then you can simply check if the value is at most 127. +inet_addr +--------- + +This function only supports IPv4 and it supports a variety of weird ways to type +IPv4 addresses. Use inet_pton instead, which supports other address families as +well and only support standard address notations. + +Soritx currently implements a stub of this function that calls abort(), this is +for compatibility to get some ports to compile (the ports should be patched to +use inet_pton instead). + +inet_ntoa +--------- + +This function only supports IPv4 and it isn't thread safe. Use inet_ntop instead +which is thread safe and supports other address families. + +Soritx currently implements a stub of this function that calls abort(), this is +for compatibility to get some ports to compile (the ports should be patched to +use inet_ntop instead). + lockf ----- diff --git a/libc/include/arpa/inet.h b/libc/include/arpa/inet.h index 9f5c7c30..80350895 100644 --- a/libc/include/arpa/inet.h +++ b/libc/include/arpa/inet.h @@ -30,7 +30,9 @@ extern "C" { /* Functions from POSIX that is considered obsolete due to bad design. */ #if __USE_SORTIX || __USE_POSIX +__attribute__((__warning__("inet_addr is deprecated by inet_pton"))) in_addr_t inet_addr(const char*); +__attribute__((__warning__("inet_ntoa is deprecated by inet_ntop"))) char* inet_ntoa(struct in_addr); #endif