Hi Garrett,

On Fri, 16 Jan 2009, Garrett Cooper wrote:

On Fri, Jan 16, 2009 at 12:58 AM, Garrett Cooper <yanef...@gmail.com> wrote:
On Fri, Jan 16, 2009 at 12:57 AM, Christoph Mallon
<christoph.mal...@gmx.de> wrote:
Garrett Cooper schrieb:

Good point. I modified the source to do that.
Thanks,
-Garrett

You should reply to all so the discussion stays on the list.

Yeah, that was a goofup on my part. Go-go Gmail web interface!
-Garrett

Hmmm... looks like the strerror issue it could be a serious bug:

Add #include <string.h>.

Without it you don't get the strerror() prototype, so the return value
defaults to an int. Thus the compiler will truncate the pointer value
to junk.  The crash happens when formatting the output.

Compile with -Wall and pay attention to warnings (or use -Werror)
to catch these things.

    $.02,
    /Mikko


#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);
               err(errno, "%s", strerror(o_errno));
       }

       return 0;

}

[gcoo...@optimus ~]$ ./badfile
Errno: 2
badfile: Segmentation fault: 11 (core dumped)

   I rebuilt my kernel and installed it, and I rebuilt world, but
haven't installed it yet though, so let me reboot the amd64 machine
and see what happens (may be a mismatched ABI issue)...
Cheers,
-Garrett
_______________________________________________
freebsd-am...@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-amd64
To unsubscribe, send any mail to "freebsd-amd64-unsubscr...@freebsd.org"

_______________________________________________
freebsd-hackers@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to "freebsd-hackers-unsubscr...@freebsd.org"

Reply via email to