From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Wolfgang Jaehrling Newsgroups: gmane.lisp.guile.devel Subject: Re: gethostname max len Date: Mon, 22 Mar 2004 02:05:11 +0100 Sender: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Message-ID: <20040322010510.GA235@gmx.de> References: <87ad29on5v.fsf@zip.com.au> Reply-To: Wolfgang Jaehrling NNTP-Posting-Host: deer.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1079917260 23528 80.91.224.253 (22 Mar 2004 01:01:00 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Mon, 22 Mar 2004 01:01:00 +0000 (UTC) Cc: guile-devel@gnu.org Original-X-From: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Mon Mar 22 02:00:54 2004 Return-path: Original-Received: from monty-python.gnu.org ([199.232.76.173]) by deer.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 1B5DoD-0002Ni-00 for ; Mon, 22 Mar 2004 02:00:53 +0100 Original-Received: from localhost ([127.0.0.1] helo=monty-python.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.30) id 1B5Dn2-0003Gu-Rf for guile-devel@m.gmane.org; Sun, 21 Mar 2004 19:59:40 -0500 Original-Received: from list by monty-python.gnu.org with tmda-scanned (Exim 4.30) id 1B5Dlb-0002tw-Lq for guile-devel@gnu.org; Sun, 21 Mar 2004 19:58:11 -0500 Original-Received: from mail by monty-python.gnu.org with spam-scanned (Exim 4.30) id 1B5Dl3-0002nG-E3 for guile-devel@gnu.org; Sun, 21 Mar 2004 19:58:08 -0500 Original-Received: from [213.165.64.20] (helo=mail.gmx.net) by monty-python.gnu.org with smtp (Exim 4.30) id 1B5Dl2-0002n5-UX for guile-devel@gnu.org; Sun, 21 Mar 2004 19:57:37 -0500 Original-Received: (qmail 22937 invoked by uid 65534); 22 Mar 2004 00:57:30 -0000 Original-Received: from dialin-145-254-211-224.arcor-ip.net (EHLO kaputt.schrott) (145.254.211.224) by mail.gmx.net (mp025) with SMTP; 22 Mar 2004 01:57:30 +0100 X-Authenticated: #897519 Original-Received: from wj by kaputt.schrott with local (Exim 3.35 #1 (Debian)) id 1B5DsN-00007f-00; Mon, 22 Mar 2004 02:05:11 +0100 Original-To: Kevin Ryde Content-Disposition: inline In-Reply-To: <87ad29on5v.fsf@zip.com.au> User-Agent: Mutt/1.3.28i X-BeenThere: guile-devel@gnu.org X-Mailman-Version: 2.1.4 Precedence: list List-Id: "Developers list for Guile, the GNU extensibility library" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Xref: main.gmane.org gmane.lisp.guile.devel:3554 X-Report-Spam: http://spam.gmane.org/gmane.lisp.guile.devel:3554 On Mon, Mar 22, 2004 at 08:22:52AM +1000, Kevin Ryde wrote: > * posix.c (scm_gethostname): Use sysconf(_SC_HOST_NAME_MAX) and > MAXHOSTNAMELEN when available. > > It's possible MAXHOSTNAMELEN is enough in practice, but posix > specifies HOST_NAME_MAX instead of MAXHOSTNAMELEN, so it seems > worthwhile checking that too. The Single Unix Specification says about sysconf(): "If name is an invalid value, sysconf() shall return -1 and set errno to indicate the error. If the variable corresponding to name has no limit, sysconf() shall return -1 without changing the value of errno." And in the following informative section: "As -1 is a permissible return value in a successful situation, an application wishing to check for error situations should set errno to 0, then call sysconf(), and, if it returns -1, check to see if errno is non-zero." Which is what Guile probably also should do, otherwise it won't work correctly on the GNU system, which has no limit on the length of host names; the current code that checks for ENAMETOOLONG looks quite GNU/Linux-specific. Cheers, Wolfgang -- Repeating false statements makes them true. Repeating false statements makes them true. Repeating false statements makes them true. _______________________________________________ Guile-devel mailing list Guile-devel@gnu.org http://mail.gnu.org/mailman/listinfo/guile-devel