From a273954f02ddfec25a87e949e71fe8da1bc74ec9 Mon Sep 17 00:00:00 2001
From: Lectem <lectem@gmail.com>
Date: Tue, 27 Oct 2015 15:13:26 -0400
Subject: [PATCH 1/1] ff_getnameinfo: fix struct servent dependancy

On systems lacking getservbyport, struct servent might not be defined,
causing a compilation error when trying to access its member s_name (ent->s_name).
There is no point in keeping the if(ent) branch when getservbyport is not
available.

Signed-off-by: Clément Grégoire <lectem@gmail.com>
---
 libavformat/os_support.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavformat/os_support.c b/libavformat/os_support.c
index 7950e44..77d42ea 100644
--- a/libavformat/os_support.c
+++ b/libavformat/os_support.c
@@ -209,11 +209,11 @@ int ff_getnameinfo(const struct sockaddr *sa, int salen,
 #if HAVE_GETSERVBYPORT
         if (!(flags & NI_NUMERICSERV))
             ent = getservbyport(sin->sin_port, flags & NI_DGRAM ? "udp" : "tcp");
-#endif /* HAVE_GETSERVBYPORT */
 
         if (ent)
             snprintf(serv, servlen, "%s", ent->s_name);
         else
+#endif /* HAVE_GETSERVBYPORT */
             snprintf(serv, servlen, "%d", ntohs(sin->sin_port));
     }
 
-- 
1.9.5.msysgit.1

