From owner-freebsd-arch@FreeBSD.ORG Thu May 3 00:50:41 2007 Return-Path: X-Original-To: arch@freebsd.org Delivered-To: freebsd-arch@FreeBSD.ORG Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 722A816A403 for ; Thu, 3 May 2007 00:50:41 +0000 (UTC) (envelope-from deischen@freebsd.org) Received: from mail.ntplx.net (mail.ntplx.net [204.213.176.10]) by mx1.freebsd.org (Postfix) with ESMTP id 3601F13C4CA for ; Thu, 3 May 2007 00:50:41 +0000 (UTC) (envelope-from deischen@freebsd.org) Received: from sea.ntplx.net (sea.ntplx.net [204.213.176.11]) by mail.ntplx.net (8.14.0/8.14.0/NETPLEX) with ESMTP id l430oPuM007809; Wed, 2 May 2007 20:50:25 -0400 (EDT) X-Virus-Scanned: by AMaViS and Clam AntiVirus (mail.ntplx.net) X-Greylist: Message whitelisted by DRAC access database, not delayed by milter-greylist-3.0 (mail.ntplx.net [204.213.176.10]); Wed, 02 May 2007 20:50:25 -0400 (EDT) Date: Wed, 2 May 2007 20:50:25 -0400 (EDT) From: Daniel Eischen X-X-Sender: eischen@sea.ntplx.net To: "Sean C. Farley" In-Reply-To: <20070502183100.P1317@baba.farley.org> Message-ID: References: <20070501083009.GA4627@nagual.pp.ru> <20070501160645.GA9333@nagual.pp.ru> <20070501135439.B36275@thor.farley.org> <20070502.102822.-957833022.imp@bsdimp.com> <20070502183100.P1317@baba.farley.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Cc: arch@freebsd.org Subject: Re: HEADS DOWN X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: Daniel Eischen List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 03 May 2007 00:50:41 -0000 On Wed, 2 May 2007, Sean C. Farley wrote: > > Here[1] is my POSIX version of the *env() (including putenv()) > functions. It also has the leak-avoidance change that occurs with > setenv("ab") -> setenv("a") -> setenv("ab"). It is also faster than the > current code. > > Where it diverges from POSIX: > 1. putenv() sets errno to EINVAL since it performs checks (NULL pointer, > empty string and string without '=') on the string given to it. It > makes it a bit more like setenv() in its validation. I found this > note[2] that says that providing invalid data to putenv() will result > in undefined behavior. I thought that undefined could mean an error > is returned. The check is easy to remove. I think that is fine as it falls under "undefined behavior", and the function is already defined as returning an error code. > 2. getenv() sets errno to EINVAL and returns NULL if given a bad name to > find. setenv() and unsetenv() perform the same check on the name; > should not getenv() do the same? The check is easy to remove. I don't think getenv() should set errno. The fact that it returns NULL is sufficient and POSIX doesn't define any errors for it. -- DE