Skip to content
Tcl Source Code View Ticket
Login

View Ticket

file atime & mtime broken for 64 bit OSs

Closed / Fixed698146ffffffffffffffffffffffffffffffffffCreated 24 years agoUpdated 24 years ago
Descriptionplain2003-03-05 18:26:56
When tcl is compiled for a 64-bit IRIX64 platform the
'file atime' and 'file mtime' commands do not set the
times correctly. 

This is due to a bug in tclCmdAH.c :
Line 841 - 844 contain
if (Tcl_GetLongFromObj(interp, objv[3],
(long*)(&buf.st_atime)) != TCL_OK) {
    return TCL_ERROR;
}

But the stat buf contains 32 bit ints for atime &
mtime, not 64 bit longs, so the code could be replaced
with this:

      long along;
if (Tcl_GetLongFromObj(interp, objv[3],
&along) != TCL_OK) {
    return TCL_ERROR;
}
buf.st_mtime = along;

Where the last line implicitly does the type
conversion.

Similar for mtime.
dkfplain2003-03-07 18:52:20
Logged In: YES 
user_id=79902

It's fractionally better (fewer assignments) to put the
value read from the long directly into the utimbuf instead
of the statbuf.

In the HEAD now.  (Left open to remind me to check this into
the 8.4 branch.)
dkf Closed ticket [698146ffff]. [History diff]2003-03-15 05:01:17
Log in (anonymous is fine) to add a comment.