Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.2 9/18/84; site cheviot.uucp Path: utzoo!watmath!clyde!burl!ulysses!allegra!mit-eddie!think!harvard!seismo!mcvax!ukc!cheviot!robert From: robert@cheviot.uucp (Robert Stroud) Newsgroups: net.bugs.4bsd Subject: inet(3n), , inet_addr() Message-ID: <457@cheviot.uucp> Date: Mon, 14-Oct-85 08:41:41 EDT Article-I.D.: cheviot.457 Posted: Mon Oct 14 08:41:41 1985 Date-Received: Thu, 17-Oct-85 00:46:53 EDT Reply-To: robert@cheviot.UUCP (Robert Stroud) Organization: U. of Newcastle upon Tyne, U.K. Lines: 47 Description: Programs that follow the manual page inet(3n) will crash. They won't even compile if you take the page literally! Repeat-by: Run this program on an IP address in your /etc/hosts file # include /* NOT !! */ # include # include main(argc, argv) int argc; char *argv[]; { struct in_addr addr; addr = inet_addr(argv[1]); } Diagnosis: Contrary to the manual page and the include file, the routine "inet_addr" returns "u_long" rather than "struct in_addr". The manual page almost admits this in the DIAGNOSTICS section "The value -1 is returned by inet_addr for malformed requests" Note that "-1" is not even a "u_long", let alone a "struct in_addr"! Fix-by: Alter the SYNOPSIS part of inet(3n) to read # include # include # include long inet_addr(cp) char *cp; Fix and lib/libc/inet/inet_addr.c accordingly. Robert Stroud, Computing Laboratory, University of Newcastle upon Tyne. ARPA robert%cheviot.newcastle@ucl-cs.ARPA UUCP ...!ukc!cheviot!robert