ctime(3) broken in 4.2 release

Jeff Gilliam jeff at voder.UUCP
Sat Aug 4 07:04:37 AEST 1984


Index:	lib/libc/gen/ctime.c 4.2BSD Fix

Description:
	The ctime(3) function is broken in the 4.2 BSD release.
	Sometime after the 4.1 release someone changed all the 'long'
	variables in ctime.c to 'unsigned long'.  This is *wrong*.
	At the UNIX epoch (Jan 1 00:00:00 1970 GMT) local time is
	*negative*.

Repeat-By:
	Mount a level 0 dump tape.  Type 'restore t'.  If your system
	has the bug you will see output similar to:

		Dump   date: Fri Aug  3 13:23:12 1984
		Dumped from: Sat Feb  5 22:28:16 206	<<< ???
			.
			.
			.
Fix:
	To correct, simply edit ctime.c and change every 'unsigned
	long' to 'long', recompile, and add the corrected binary to
	libc.a.  Don't forget to do a ranlib on libc.a afterward.
	Finally, recompile restore and install.

	(As an aside, assuming longs are 32 bits, the return to
	signed numbers still allows keeping time correctly until
	2038.)

-- 
Jeff Gilliam	{ucbvax,ihnp4!nsc}!voder!jeff



More information about the Comp.bugs.4bsd.ucb-fixes mailing list