aboutsummaryrefslogtreecommitdiff
path: root/gdb/ser-tcp.c
diff options
context:
space:
mode:
authorStu Grossman <grossman@cygnus>1993-05-29 03:14:45 +0000
committerStu Grossman <grossman@cygnus>1993-05-29 03:14:45 +0000
commit69b2f0fe81dcaf544920f5cf33c04e2f491a8bd4 (patch)
treed4dcf6239eeb2d15a7aa5993b7303af16044f745 /gdb/ser-tcp.c
parent22aa3d61b8d8ffe956ebac3fc19ebe16e7c5f162 (diff)
downloadgdb-69b2f0fe81dcaf544920f5cf33c04e2f491a8bd4.zip
gdb-69b2f0fe81dcaf544920f5cf33c04e2f491a8bd4.tar.gz
gdb-69b2f0fe81dcaf544920f5cf33c04e2f491a8bd4.tar.bz2
Use getprotobyname instead of hardwired number (in tcp_open).
Diffstat (limited to 'gdb/ser-tcp.c')
-rw-r--r--gdb/ser-tcp.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/gdb/ser-tcp.c b/gdb/ser-tcp.c
index 4f4fcdb..3b30bf1 100644
--- a/gdb/ser-tcp.c
+++ b/gdb/ser-tcp.c
@@ -57,6 +57,7 @@ tcp_open(scb, name)
struct sockaddr_in sockaddr;
int tmp;
char hostname[100];
+ struct protoent *protoent;
port_str = strchr (name, ':');
@@ -98,8 +99,13 @@ tcp_open(scb, name)
return -1;
}
+ protoent = getprotobyname ("tcp");
+ if (!protoent)
+ return -1;
+
tmp = 1;
- if (setsockopt (scb->fd, 6, TCP_NODELAY, (char *)&tmp, sizeof(tmp)))
+ if (setsockopt (scb->fd, protoent->p_proto, TCP_NODELAY,
+ (char *)&tmp, sizeof(tmp)))
return -1;
signal(SIGPIPE, SIG_IGN); /* If we don't do this, then GDB simply exits