From: Stu Grossman Date: Sat, 29 May 1993 03:14:45 +0000 (+0000) Subject: Use getprotobyname instead of hardwired number (in tcp_open). X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=69b2f0fe81dcaf544920f5cf33c04e2f491a8bd4;p=binutils-gdb.git Use getprotobyname instead of hardwired number (in tcp_open). --- diff --git a/gdb/ser-tcp.c b/gdb/ser-tcp.c index 4f4fcdbc2c3..3b30bf1f8cf 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