summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordkf <donal.k.fellows@manchester.ac.uk>2003-03-14 21:48:32 (GMT)
committerdkf <donal.k.fellows@manchester.ac.uk>2003-03-14 21:48:32 (GMT)
commitcca3e3c842ce7be6eae3ace0eaadf8748c3ea20d (patch)
treee64598aea32205456e2f2924b7a543cc875f161f
parent5b39ab8cefba4d3245053e8090ca9b7d871aa677 (diff)
downloadtcl-cca3e3c842ce7be6eae3ace0eaadf8748c3ea20d.zip
tcl-cca3e3c842ce7be6eae3ace0eaadf8748c3ea20d.tar.gz
tcl-cca3e3c842ce7be6eae3ace0eaadf8748c3ea20d.tar.bz2
Backport of fix for 698146 to remove assumption that time_t is a long...
-rw-r--r--ChangeLog3
-rw-r--r--generic/tclCmdAH.c16
2 files changed, 12 insertions, 7 deletions
diff --git a/ChangeLog b/ChangeLog
index 60d03f2..e6f9771 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,8 @@
2003-03-14 Donal K. Fellows <fellowsd@cs.man.ac.uk>
+ * generic/tclCmdAH.c (Tcl_FileObjCmd): Remove assumption that file
+ times and longs are the same size. [Bug #698146]
+
* generic/tclCmdAH.c (Tcl_FormatObjCmd): Only add the modifier
that indicates we've got a wide int when we're formatting in an
integer style. Stops some libc's from going mad. [Bug #702622]
diff --git a/generic/tclCmdAH.c b/generic/tclCmdAH.c
index 8d1387a..e7bd499 100644
--- a/generic/tclCmdAH.c
+++ b/generic/tclCmdAH.c
@@ -11,7 +11,7 @@
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tclCmdAH.c,v 1.27.2.1 2003/03/14 16:19:11 dkf Exp $
+ * RCS: @(#) $Id: tclCmdAH.c,v 1.27.2.2 2003/03/14 21:48:46 dkf Exp $
*/
#include "tclInt.h"
@@ -835,11 +835,12 @@ Tcl_FileObjCmd(dummy, interp, objc, objv)
return TCL_ERROR;
}
if (objc == 4) {
- if (Tcl_GetLongFromObj(interp, objv[3],
- (long*)(&buf.st_atime)) != TCL_OK) {
+ long newTime;
+
+ if (Tcl_GetLongFromObj(interp, objv[3], &newTime) != TCL_OK) {
return TCL_ERROR;
}
- tval.actime = buf.st_atime;
+ tval.actime = newTime;
tval.modtime = buf.st_mtime;
if (Tcl_FSUtime(objv[2], &tval) != 0) {
Tcl_AppendStringsToObj(Tcl_GetObjResult(interp),
@@ -1071,12 +1072,13 @@ Tcl_FileObjCmd(dummy, interp, objc, objv)
return TCL_ERROR;
}
if (objc == 4) {
- if (Tcl_GetLongFromObj(interp, objv[3],
- (long*)(&buf.st_mtime)) != TCL_OK) {
+ long newTime;
+
+ if (Tcl_GetLongFromObj(interp, objv[3], &newTime) != TCL_OK) {
return TCL_ERROR;
}
tval.actime = buf.st_atime;
- tval.modtime = buf.st_mtime;
+ tval.modtime = newTime;
if (Tcl_FSUtime(objv[2], &tval) != 0) {
Tcl_AppendStringsToObj(Tcl_GetObjResult(interp),
"could not set modification time for file \"",