Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 16 Jan 2009 19:38:06 +0100
From:      Stefan Farfeleder <stefan@fafoe.narf.at>
To:        Nate Eldredge <neldredge@math.ucsd.edu>
Cc:        Thierry Herbelot <thierry.herbelot@free.fr>, Garrett Cooper <yanefbsd@gmail.com>, Christoph Mallon <christoph.mallon@gmx.de>, freebsd-hackers@freebsd.org
Subject:   Re: Confused by segfault with legitimate call to strerror(3) on amd64 / sysctl (3) setting `odd' errno's
Message-ID:  <20090116183806.GB1355@lizard.fafoe.narf.at>
In-Reply-To: <Pine.GSO.4.64.0901161023030.18030@zeno.ucsd.edu>
References:  <7d6fde3d0901160041n55466290l55f737d274a40895@mail.gmail.com> <49705FA2.2020605@gmx.de> <7d6fde3d0901160235o6aa1f096q11c5096b70f3577@mail.gmail.com> <200901161152.53478.thierry.herbelot@free.fr> <7d6fde3d0901161006r79f0cac4yf80c9c5079152b87@mail.gmail.com> <Pine.GSO.4.64.0901161023030.18030@zeno.ucsd.edu>

next in thread | previous in thread | raw e-mail | index | archive | help
On Fri, Jan 16, 2009 at 10:33:15AM -0800, Nate Eldredge wrote:
> Pop quiz: which of the following statements is correct?
> 
> #include <stdlib.h>
> #include <unistd.h>
> 
> execl("/bin/sh", "/bin/sh", 0);
> execl("/bin/sh", "/bin/sh", NULL);

None, as NULL is allowed to expand to 0.  You have to write

execl("/bin/sh", "/bin/sh", (char *)0);



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