From owner-freebsd-doc@FreeBSD.ORG Mon Mar 15 02:00:37 2004 Return-Path: Delivered-To: freebsd-doc@hub.freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 81C6716A4CF for ; Mon, 15 Mar 2004 02:00:37 -0800 (PST) Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id 1F4DE43D49 for ; Mon, 15 Mar 2004 02:00:36 -0800 (PST) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) i2FA0Zbv093647 for ; Mon, 15 Mar 2004 02:00:35 -0800 (PST) (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.12.10/8.12.10/Submit) id i2FA0Zah093637; Mon, 15 Mar 2004 02:00:35 -0800 (PST) (envelope-from gnats) Resent-Date: Mon, 15 Mar 2004 02:00:35 -0800 (PST) Resent-Message-Id: <200403151000.i2FA0Zah093637@freefall.freebsd.org> Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer) Resent-To: freebsd-doc@FreeBSD.org Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org, Lee Brotherston Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 1AC0E16A4ED for ; Mon, 15 Mar 2004 01:58:26 -0800 (PST) Received: from www.freebsd.org (www.freebsd.org [216.136.204.117]) by mx1.FreeBSD.org (Postfix) with ESMTP id 14BAB43D4C for ; Mon, 15 Mar 2004 01:58:26 -0800 (PST) (envelope-from nobody@FreeBSD.org) Received: from www.freebsd.org (localhost [127.0.0.1]) by www.freebsd.org (8.12.10/8.12.10) with ESMTP id i2F9wP72094021 for ; Mon, 15 Mar 2004 01:58:25 -0800 (PST) (envelope-from nobody@www.freebsd.org) Received: (from nobody@localhost) by www.freebsd.org (8.12.10/8.12.10/Submit) id i2F9wPdP094019; Mon, 15 Mar 2004 01:58:25 -0800 (PST) (envelope-from nobody) Message-Id: <200403150958.i2F9wPdP094019@www.freebsd.org> Date: Mon, 15 Mar 2004 01:58:25 -0800 (PST) From: Lee Brotherston To: freebsd-gnats-submit@FreeBSD.org X-Send-Pr-Version: www-2.3 Subject: docs/64291: inet_ntoa static buffer - man page ammendment X-BeenThere: freebsd-doc@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Documentation project List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 15 Mar 2004 10:00:37 -0000 >Number: 64291 >Category: docs >Synopsis: inet_ntoa static buffer - man page ammendment >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-doc >State: open >Quarter: >Keywords: >Date-Required: >Class: doc-bug >Submitter-Id: current-users >Arrival-Date: Mon Mar 15 02:00:35 PST 2004 >Closed-Date: >Last-Modified: >Originator: Lee Brotherston >Release: FreeBSD 5.2.1-RELEASE >Organization: >Environment: FreeBSD 5.2.1-RELEASE FreeBSD 5.2.1-RELEASE #2: Mon Mar 8 03:32:49 GMT 2004 lee@:/usr/obj/usr/src/sys/MYKERN i386 >Description: The man page for inet_ntoa does not mention that is uses a static buffer. It is perhaps worth mentioning this as further calls to inet_ntoa will overwrite the previous response. Perhaps this should be obvious, however I just fell foul of this and thought clarification on the man page might be useful. >How-To-Repeat: The following section of code (where ip_hdr is a struct *ip) will log both addresses to be the same when they are not. Presumably because both inet_ntoa's are evaluated before the log function is run. As a result the first result has been lost. log(LOG_INFO, "%s -> %s", inet_ntoa(ip_hdr->ip_src), inet_ntoa(ip_hdr->ip_dst)); >Fix: Ammendment to the man page. If it helps I found this version on a linux machines manpage: The inet_ntoa() function converts the Internet host address in given in network byte order to a string in standard numbers-and-dots notation. The string is returned in a statically allocated buffer, which subsequent calls will overwrite. >Release-Note: >Audit-Trail: >Unformatted: