Date: Fri, 16 Jan 2009 10:06:52 -0800 From: Garrett Cooper <yanefbsd@gmail.com> To: Thierry Herbelot <thierry.herbelot@free.fr> Cc: freebsd-hackers@freebsd.org, Christoph Mallon <christoph.mallon@gmx.de> Subject: Re: Confused by segfault with legitimate call to strerror(3) on amd64 / sysctl (3) setting `odd' errno's Message-ID: <7d6fde3d0901161006r79f0cac4yf80c9c5079152b87@mail.gmail.com> In-Reply-To: <200901161152.53478.thierry.herbelot@free.fr> References: <7d6fde3d0901160041n55466290l55f737d274a40895@mail.gmail.com> <49705FA2.2020605@gmx.de> <7d6fde3d0901160235o6aa1f096q11c5096b70f3577@mail.gmail.com> <200901161152.53478.thierry.herbelot@free.fr>
next in thread | previous in thread | raw e-mail | index | archive | help
On Fri, Jan 16, 2009 at 2:52 AM, Thierry Herbelot <thierry.herbelot@free.fr> wrote: > Le Friday 16 January 2009, Garrett Cooper a =E9crit : >> On Fri, Jan 16, 2009 at 2:21 AM, Christoph Mallon >> >> #include <errno.h> >> #include <stdio.h> >> #include <sys/stat.h> >> >> int >> main() >> { >> >> struct stat sb; >> >> int o_errno; >> >> if (stat("/some/file/that/doesn't/exist", &sb) !=3D 0) { >> o_errno =3D errno; >> printf("Errno: %d\n", errno); >> printf("%s\n", strerror(o_errno)); >> } >> >> return 0; >> >> } >> > with this, it's better on an amd64/ RELENG_7 machine : > > % diff -ub badfile.c.ori badfile.c > --- badfile.c.ori 2009-01-16 11:49:44.778991057 +0100 > +++ badfile.c 2009-01-16 11:49:03.470465677 +0100 > @@ -1,6 +1,7 @@ > #include <errno.h> > #include <stdio.h> > #include <sys/stat.h> > +#include <string.h> > > int > main() > > Cheers > > TfH That's hilarious -- why does it pass though without issue on x86 though? -Garrett
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?7d6fde3d0901161006r79f0cac4yf80c9c5079152b87>