Date: Fri, 16 Jan 2009 10:39:00 +0100 From: Christian Kandeler <christian.kandeler@hob.de> To: 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: <200901161039.00232.christian.kandeler@hob.de> In-Reply-To: <49704AEC.3080709@gmx.de> References: <7d6fde3d0901160041n55466290l55f737d274a40895@mail.gmail.com> <49704AEC.3080709@gmx.de>
next in thread | previous in thread | raw e-mail | index | archive | help
On Friday 16 January 2009 09:53, Christoph Mallon wrote:
> > int
> > main() {
> >
> > int mib[4];
> >
> > size_t len;
> >
> > if (sysctlnametomib("kern.ipc.shmmax", mib, &len) != 0) {
> > printf("Errno: %d\n", errno);
> > errx(errno, "Error: %s", strerror(errno));
>
> The use of errno is wrong. printf might change errno.
I don't think printf() can set errno. And even if it could, it
wouldn't matter, because C has call-by-value semantics.
Christian
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200901161039.00232.christian.kandeler>
