[comp.lang.c] Interesting bug in compress on 88000 Systems

clewis@ferret.ocunix.on.ca (Chris Lewis) (04/19/91)

[Pardon the cross-post, but this seemed to be of interest to both the OS
people and the language people]

When compress tries to set the time on the file it's just
created to be the same as the original file, things go a little
awry.  The code is:

	time_t timep[2];
	...
	timep[0] = statbuf.st_atime;
	timep[1] = statbuf.st_mtime;
	utime(ofname, timep);	/* Update last accessed and modified times */

On the 88000, (as in 1003.1), timep is actually a struct.  All would be well,
except on the 88000 they've inserted an additional time_t after the atime
and the mtime field to contain microseconds....  So, what happens is that
the atime is set properly, the atime usec field is set to mtime, and the mtime is
set to garbage (the epoch due to the stack contents in my case).  I'm not sure
whether this makes the OS/header file noncompliant with 1003.1.

Looks to me that compress.c needs an ifdef so as to use the struct
definition.

(Motorola Delta 88000 system with Greenhills C compiler)
-- 
Chris Lewis, Phone: (613) 832-0541, Internet: clewis@ferret.ocunix.on.ca
UUCP: uunet!mitel!cunews!latour!ecicrl!clewis; Ferret Mailing List:
ferret-request@eci386; Psroff (not Adobe Transcript) enquiries:
psroff-request@eci386 or Canada 416-832-0541.  Psroff 3.0 in c.s.u soon!