aboutsummaryrefslogtreecommitdiff
path: root/gdb/ser-tcp.c
diff options
context:
space:
mode:
authorPedro Alves <palves@redhat.com>2015-03-09 11:27:05 +0000
committerPedro Alves <palves@redhat.com>2015-03-09 11:27:05 +0000
commit9eb1356e381f3412f53ffe5bc68ce854330600fb (patch)
tree1a764e6c10e8942911c65b959e99eae4e9d774e4 /gdb/ser-tcp.c
parent43fa85d9a8d7aac7a70c72220abd09d39703208a (diff)
downloadgdb-9eb1356e381f3412f53ffe5bc68ce854330600fb.zip
gdb-9eb1356e381f3412f53ffe5bc68ce854330600fb.tar.gz
gdb-9eb1356e381f3412f53ffe5bc68ce854330600fb.tar.bz2
Revert union gdb_sockaddr_u
This reverts 366c75fc. We don't actually need to access the object through "struct sockaddr *", so we don't need the union: https://sourceware.org/ml/gdb-patches/2015-03/msg00213.html gdb/ChangeLog: 2015-03-09 Pedro Alves <palves@redhat.com> Revert: 2015-03-07 Pedro Alves <palves@redhat.com> * common/gdb_socket.h: New file. * ser-tcp.c: Include gdb_socket.h. Don't include netinet/in.h nor sys/socket.h. (net_open): Use union gdb_sockaddr_u. gdb/gdbserver/ChangeLog: 2015-03-09 Pedro Alves <palves@redhat.com> Revert: 2015-03-07 Pedro Alves <palves@redhat.com> * gdbreplay.c: No longer include <netinet/in.h>, <sys/socket.h>, or <winsock2.h> here. Instead include "gdb_socket.h". (remote_open): Use union gdb_sockaddr_u. * remote-utils.c: No longer include <netinet/in.h>, <sys/socket.h> or <winsock2.h> here. Instead include "gdb_socket.h". (handle_accept_event, remote_prepare): Use union gdb_sockaddr_u. * tracepoint.c: Include "gdb_socket.h" instead of <sys/socket.h> or <sys/un.h>. (init_named_socket, gdb_agent_helper_thread): Use union gdb_sockaddr_u.
Diffstat (limited to 'gdb/ser-tcp.c')
-rw-r--r--gdb/ser-tcp.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/gdb/ser-tcp.c b/gdb/ser-tcp.c
index 648f1fb..9c3dcf4 100644
--- a/gdb/ser-tcp.c
+++ b/gdb/ser-tcp.c
@@ -37,8 +37,6 @@
#include <sys/time.h>
-#include "gdb_socket.h"
-
#ifdef USE_WIN32API
#include <winsock2.h>
#ifndef ETIMEDOUT
@@ -47,8 +45,10 @@
#define close(fd) closesocket (fd)
#define ioctl ioctlsocket
#else
+#include <netinet/in.h>
#include <arpa/inet.h>
#include <netdb.h>
+#include <sys/socket.h>
#include <netinet/tcp.h>
#endif
@@ -159,7 +159,7 @@ net_open (struct serial *scb, const char *name)
int n, port, tmp;
int use_udp;
struct hostent *hostent;
- union gdb_sockaddr_u sockaddr;
+ struct sockaddr_in sockaddr;
#ifdef USE_WIN32API
u_long ioarg;
#else
@@ -199,9 +199,9 @@ net_open (struct serial *scb, const char *name)
return -1;
}
- sockaddr.sa_in.sin_family = PF_INET;
- sockaddr.sa_in.sin_port = htons (port);
- memcpy (&sockaddr.sa_in.sin_addr.s_addr, hostent->h_addr,
+ sockaddr.sin_family = PF_INET;
+ sockaddr.sin_port = htons (port);
+ memcpy (&sockaddr.sin_addr.s_addr, hostent->h_addr,
sizeof (struct in_addr));
retry:
@@ -220,7 +220,7 @@ net_open (struct serial *scb, const char *name)
/* Use Non-blocking connect. connect() will return 0 if connected
already. */
- n = connect (scb->fd, &sockaddr.sa, sizeof (sockaddr.sa_in));
+ n = connect (scb->fd, (struct sockaddr *) &sockaddr, sizeof (sockaddr));
if (n < 0)
{