aboutsummaryrefslogtreecommitdiff
path: root/winsup/cygwin
diff options
context:
space:
mode:
authorCorinna Vinschen <corinna@vinschen.de>2015-08-18 13:12:07 +0200
committerCorinna Vinschen <corinna@vinschen.de>2015-08-18 13:12:07 +0200
commitcb2ab5fd01265b2aa4a40865e4bd244f789328ff (patch)
tree5ceabe184a9479e817ae781c0a16615043a9cc4f /winsup/cygwin
parentf9f3d44f27008154b83c088b62ab82cc4168f5ac (diff)
downloadnewlib-cb2ab5fd01265b2aa4a40865e4bd244f789328ff.zip
newlib-cb2ab5fd01265b2aa4a40865e4bd244f789328ff.tar.gz
newlib-cb2ab5fd01265b2aa4a40865e4bd244f789328ff.tar.bz2
Cygwin: Return port number from getservent in network byte order
* netdb.cc (parse_services_line): Convert port number to network byte order. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
Diffstat (limited to 'winsup/cygwin')
-rw-r--r--winsup/cygwin/ChangeLog5
-rw-r--r--winsup/cygwin/netdb.cc4
-rw-r--r--winsup/cygwin/release/2.2.14
3 files changed, 11 insertions, 2 deletions
diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog
index ba2b657..3e1518d 100644
--- a/winsup/cygwin/ChangeLog
+++ b/winsup/cygwin/ChangeLog
@@ -1,5 +1,10 @@
2015-08-18 Corinna Vinschen <corinna@vinschen.de>
+ * netdb.cc (parse_services_line): Convert port number to network byte
+ order.
+
+2015-08-18 Corinna Vinschen <corinna@vinschen.de>
+
* exceptions.cc: Drop including ucontext.h.
2015-08-17 Corinna Vinschen <corinna@vinschen.de>
diff --git a/winsup/cygwin/netdb.cc b/winsup/cygwin/netdb.cc
index 3e3b354..cc0a2ca 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 294e0c9..24a4b81 100644
--- a/winsup/cygwin/release/2.2.1
+++ b/winsup/cygwin/release/2.2.1
@@ -23,3 +23,7 @@ Bug Fixes
- Include <sys/ucontext.h> from <sys/signal.h> 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