problems with ctime_r

Ed Barker barkeref@sigcomp.com
Thu Dec 21 11:27:00 GMT 2000


I just downloaded the latest version of pthreads-win32, and I am now
getting errors.

Most of the errors were due to redefinitions of symbols defined in winsock.
 I was able to work around this by making sure I included winsock before
pthread.h.

However, I am still getting errors when trying to call the function
ctime_r.  My old code used to work, so I diffed the old and new versions of
pthread.h

The old version was:

#define ctime_r( _clock, _buf, _len ) \
	( strncpy( (_buf), ctime( (_clock) ), (_len) ), \
	  (_buf) )


The new version is:

#define ctime_r( _clock, _buf ) \
	( strcpy( (_buf), ctime( (_tm) ) ),  \
          (_buf) )


It appears there was some sort of mixup with this function, because the
macro is using an undefined variable _tm.  Further, it is providing 3
arguments to strcpy, which only wants 2.

Am I going crazy here, or is this a bug?

Ed


Ed Barker
Signet Computers Inc.
1901 N Moore St.  Suite 805
Arlington, Va 22209
703-812-8585 (phone)
www.sigcomp.com
barkeref@sigcomp.com



More information about the Pthreads-win32 mailing list