Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!uunet!husc6!psuvax1!psuvax1.psu.edu!ehrlich From: ehrlich@psuvax1.psu.edu (Dan Ehrlich) Newsgroups: comp.bugs.4bsd Subject: Error in getservent Message-ID: <2861@psuvax1.psu.edu> Date: Fri, 21-Aug-87 00:00:42 EDT Article-I.D.: psuvax1.2861 Posted: Fri Aug 21 00:00:42 1987 Date-Received: Sat, 22-Aug-87 15:22:34 EDT Sender: ehrlich@psuvax1.psu.edu Reply-To: ehrlich@psuvax1.psu.edu (Dan Ehrlich) Distribution: world Organization: Penn State University, University Park, PA Lines: 27 Keywords: BSD 4.3 getservent.c After pulling my hair out for a while I discovered that although /usr/include/netdb.h indicates that the s_port field of a servent is an int, not even an u_long, the routine getservent was still assuming this field to be a u_short. Below is the patch to correct this oversight. RCS file: RCS/getservent.c,v retrieving revision 1.1 diff -c -r1.1 getservent.c *** /tmp/,RCSt1012010 Thu Aug 20 23:55:07 1987 --- getservent.c Thu Aug 20 23:53:35 1987 *************** *** 71,77 **** if (cp == NULL) goto again; *cp++ = '\0'; ! serv.s_port = htons((u_short)atoi(p)); serv.s_proto = cp; q = serv.s_aliases = serv_aliases; cp = any(cp, " \t"); --- 71,77 ---- if (cp == NULL) goto again; *cp++ = '\0'; ! serv.s_port = htonl((u_long)atoi(p)); serv.s_proto = cp; q = serv.s_aliases = serv_aliases; cp = any(cp, " \t");