Date: Fri, 16 Jan 2009 11:52:52 +0100 From: Thierry Herbelot <thierry.herbelot@free.fr> To: freebsd-hackers@freebsd.org Cc: 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: <200901161152.53478.thierry.herbelot@free.fr> In-Reply-To: <7d6fde3d0901160235o6aa1f096q11c5096b70f3577@mail.gmail.com> References: <7d6fde3d0901160041n55466290l55f737d274a40895@mail.gmail.com> <49705FA2.2020605@gmx.de> <7d6fde3d0901160235o6aa1f096q11c5096b70f3577@mail.gmail.com>
next in thread | previous in thread | raw e-mail | index | archive | help
Le Friday 16 January 2009, Garrett Cooper a écrit :
> 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) != 0) {
> o_errno = 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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200901161152.53478.thierry.herbelot>
