aboutsummaryrefslogtreecommitdiff
path: root/gdb/ser-tcp.c
diff options
context:
space:
mode:
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