From owner-freebsd-current Sun Aug 18 1:54:58 2002 Delivered-To: freebsd-current@freebsd.org Received: from mx1.FreeBSD.org (mx1.FreeBSD.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id CF0EE37B400 for ; Sun, 18 Aug 2002 01:54:55 -0700 (PDT) Received: from salmon.maths.tcd.ie (salmon.maths.tcd.ie [134.226.81.11]) by mx1.FreeBSD.org (Postfix) with SMTP id 8DA0443E81 for ; Sun, 18 Aug 2002 01:54:54 -0700 (PDT) (envelope-from dwmalone@maths.tcd.ie) Received: from walton.maths.tcd.ie by salmon.maths.tcd.ie with SMTP id ; 18 Aug 2002 09:54:53 +0100 (BST) Date: Sun, 18 Aug 2002 09:54:52 +0100 From: David Malone To: Yuri Victorovich Cc: "current@FreeBSD.ORG" Subject: Re: libwrap bug? Message-ID: <20020818085452.GA80443@walton.maths.tcd.ie> References: <3D5F28BF.EE86E5AB@tsoft.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <3D5F28BF.EE86E5AB@tsoft.com> User-Agent: Mutt/1.3.25i Sender: owner-freebsd-current@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG On Sun, Aug 18, 2002 at 12:55:27AM -0400, Yuri Victorovich wrote: > Is it a bug that function "sock_host" is declared > sock_host() in /usr/include/tcpd.h > but defined as sock_host(struct request_info *) > in /usr/src/contrib/tcp_wrappers/socket.c ? A fucntion which is declared with no arguments (eg sock_host()) is assumed to be a function defined in the K&R way. Argument number and types don't need to be known. To decalre a function which takes no arguments (and which has an ANSI style definition) you say "function(void)". So this prototype is correct because the definition in socket.c is a K&R definition. Bruce tells me that gcc has some magic which allows K&R function definitions to work OK with ANSI prototypes, as long as the prototype is visable both where the function is defined and where then function is used. Otherwise, mixing K&R and ANSI can have unexpected side effects. > MySQL on Alpha gives "unaligned access..." > error because they use it w/out an argument and > actual libwrap expects an argument. The bug would seem to be calling sock_host without an argument. I've been considering adding ANSI prototypes to tcpd.h, so we get more useful warnings from it. David. To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-current" in the body of the message