I write a chat server in C. It has multiple C files linked together to a
single binary.
In OpenBSD, after compiling (which compiles without any warnings or errors
under very string warning flags), i run it and it seems that the outptu
from ctime(); is corrupted.
If i write a small sepearate program (having it include all the same
includes that my program uses), that program outputs the timestamp fine.
If i modify my main.c file (which is doing the ctime) to only do the
ctime() and exit the program, it corrupts.
If i furthur link ONLY the main.c object into the binary, i.e.
gcc -o binary main.o
and run binary, the ctime comes out fine.
None of my other C files redefine or do anything to ctime() but call it,
so i can't understand why ctime would get corrupted..esp when main() is
not running or using any variables/functions from the other C files before
doing the ctime() and exiting.
here's the relevant main.c code i'm using.
time_t newtm;
time(&newtm);
printf("Time: %ld %s\n",(unsigned long)newtm,ctime(&newtm));
and the output when run is:
Time: 996001159 ???????3s ???????3s107491
My program works on linux, AIX, FreeBSD, OSF1 without this problem.
OpenBSD is 2.9 i386
gcc is 2.95.3 20010125
libc is 26.2? (i see /usr/lib/libc.so.26.2)
Any help is appreciated..email is preferred if possible
-Tony
.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-.
Anthony J. Biacco Network Administrator/Engineer
ad...@intergrafix.net Intergrafix Internet Services
"Dream as if you'll live forever, live as if you'll die today"
http://www.asteroid-b612.org http://www.intergrafix.net
.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-.