time() segmentation fault

Chuck McManis cmcmanis at mcmanis.com
Sun Mar 21 21:50:04 PST 2004


At 09:24 PM 3/21/2004, Abel Navarro wrote:
>Hi all,
>this program ends with a segmentation fault in a FreeBSD 5.1.2-RELEASE:
>
>main() { time(); }

Good for it! Seeing as time takes a pointer to a time_t, not passing it one 
would use what ever happened to be on the stack as a pointer.

>I don't have made important changes to the release except cosmetic ones. I'm
>running the Linux compatibility module and have compiled with gcc 3.3.3. Any
>ideas are welcome.

Change it to
main() { time(0); }

And tell us if it crashes then.

--Chuck




More information about the freebsd-questions mailing list