diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog index ba2b657fb..3e1518db8 100644 --- a/winsup/cygwin/ChangeLog +++ b/winsup/cygwin/ChangeLog @@ -1,3 +1,8 @@ +2015-08-18 Corinna Vinschen + + * netdb.cc (parse_services_line): Convert port number to network byte + order. + 2015-08-18 Corinna Vinschen * exceptions.cc: Drop including ucontext.h. diff --git a/winsup/cygwin/netdb.cc b/winsup/cygwin/netdb.cc index 3e3b35498..cc0a2ca79 100644 --- a/winsup/cygwin/netdb.cc +++ b/winsup/cygwin/netdb.cc @@ -1,6 +1,6 @@ /* netdb.cc: network database related routines. - Copyright 2002, 2003, 2007, 2008, 2010, 2011, 2013 Red Hat, Inc. + Copyright 2002, 2003, 2007, 2008, 2010, 2011, 2013, 2015 Red Hat, Inc. This file is part of Cygwin. @@ -192,7 +192,7 @@ parse_services_line (FILE *svc_file, struct servent *sep) *protocol++ = '\0'; sep->s_name = strdup (name); paranoid_printf ("sep->s_name strdup %p", sep->s_name); - sep->s_port = atoi (port); + sep->s_port = htons (atoi (port)); sep->s_proto = strdup (protocol); paranoid_printf ("sep->s_proto strdup %p", sep->s_proto); /* parse_alias_list relies on side effects. Read the comments diff --git a/winsup/cygwin/release/2.2.1 b/winsup/cygwin/release/2.2.1 index 294e0c982..24a4b8187 100644 --- a/winsup/cygwin/release/2.2.1 +++ b/winsup/cygwin/release/2.2.1 @@ -23,3 +23,7 @@ Bug Fixes - Include from if compiling for POSIX.1-2008. Addresses: https://cygwin.com/ml/cygwin/2015-08/msg00266.html + +- getservent(3) returned the port number in host byte order. Change that to + network byte order as required. + Addresses: https://cygwin.com/ml/cygwin/2015-08/msg00301.html