Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 12 May 2007 17:25:03 -0500 (CDT)
From:      "Sean C. Farley" <sean-freebsd@farley.org>
To:        Robert Watson <rwatson@FreeBSD.org>
Cc:        Daniel Eischen <deischen@FreeBSD.org>, arch@FreeBSD.org, Andrey Chernov <ache@FreeBSD.org>
Subject:   Re: HEADS DOWN
Message-ID:  <20070512170737.F7595@thor.farley.org>
In-Reply-To: <20070512160859.T63806@fledge.watson.org>
References:  <20070504213312.GA33163@nagual.pp.ru> <20070504174657.D1343@thor.farley.org> <20070505213202.GA49925@nagual.pp.ru> <20070505163707.J6670@thor.farley.org> <20070505221125.GA50439@nagual.pp.ru> <20070506091835.A43775@besplex.bde.org> <20070508162458.G6015@baba.farley.org> <20070508222521.GA59534@nagual.pp.ru> <20070509200000.B56490@besplex.bde.org> <20070510184447.H4969@baba.farley.org> <20070511003443.GA6422@nagual.pp.ru> <20070511182126.U9004@baba.farley.org> <20070512160859.T63806@fledge.watson.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On Sat, 12 May 2007, Robert Watson wrote:

> On Fri, 11 May 2007, Sean C. Farley wrote:
>
>> On Fri, 11 May 2007, Andrey Chernov wrote:

<snip>

>>> I suggest to change errx() to warnx()+return(failure).
>> 
>> No need to worry any longer; I changed them into warnx().  What value
>> should I give errno?  I do not want the program to receive a random
>> error code. The first warnx() could be EINVAL.  The second warnx()
>> would be a coding error on my part.  EDOOFUS would fit.  :)  I know I
>> should not use it. EINVAL?
>
> Actually, I'm not convinced that crashing the program isn't the right
> answer.  If an application corrupts memory managed by libc or other
> libraries, crashing is generally considered an entirely acceptable
> failure mode.

There are two scenarios when rebuilding the environment for the first
time that I am using warnx/errx:
1. The user supplied an environ where a variable is missing an "=value"
    portion.
2. The code I wrote did not work as expected.

Is your thought that since the API has no means (specification-wise) to
inform the user that something is wrong that an exit should/may be
performed?  To stick with the specification, I see why errx() would be
desired.  In addition, malloc() can handle a double-free and still run
correctly.  For environ, if it is incorrect, the code will never allow
*env() to succeed.

Sean
-- 
sean-freebsd@farley.org



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20070512170737.F7595>