On Mon, 15 Oct 2012, Mans Rullgard wrote:

The absence of this function will only give a less informative
string back from our fallback implementation of getnameinfo().

Signed-off-by: Mans Rullgard <m...@mansr.com>
---
configure                | 2 ++
libavformat/os_support.c | 2 ++
2 files changed, 4 insertions(+)

diff --git a/configure b/configure
index defc2bf..5426c92 100755
--- a/configure
+++ b/configure
@@ -1171,6 +1171,7 @@ HAVE_LIST="
    GetProcessTimes
    GetSystemTimeAsFileTime
    getrusage
+    getservbyport
    gettimeofday
    gnu_as
    ibm_asm
@@ -3177,6 +3178,7 @@ if enabled network; then
    check_struct "sys/types.h sys/socket.h" "struct sockaddr" sa_len
    check_type netinet/sctp.h "struct sctp_event_subscribe"
    check_func getaddrinfo $network_extralibs
+    check_func getservbyport $network_extralibs
    # Prefer arpa/inet.h over winsock2
    if check_header arpa/inet.h ; then
        check_func closesocket
diff --git a/libavformat/os_support.c b/libavformat/os_support.c
index 7618708..451801f 100644
--- a/libavformat/os_support.c
+++ b/libavformat/os_support.c
@@ -235,8 +235,10 @@ int ff_getnameinfo(const struct sockaddr *sa, int salen,

    if (serv && servlen > 0) {
        struct servent *ent = NULL;
+#if HAVE_GETSERVBYPORT
        if (!(flags & NI_NUMERICSERV))
            ent = getservbyport(sin->sin_port, flags & NI_DGRAM ? "udp" : 
"tcp");
+#endif

        if (ent)
            snprintf(serv, servlen, "%s", ent->s_name);
--
1.7.12.3

LGTM

// Martin
_______________________________________________
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to