Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.2 9/18/84; site amdahl.UUCP Path: utzoo!watmath!clyde!cbosgd!ihnp4!zehntel!dual!amdahl!gam From: gam@amdahl.UUCP (Gordon A. Moffett) Newsgroups: net.bugs.usg,net.lang.c Subject: Re: utime misusage Message-ID: <613@amdahl.UUCP> Date: Wed, 28-Nov-84 23:31:59 EST Article-I.D.: amdahl.613 Posted: Wed Nov 28 23:31:59 1984 Date-Received: Fri, 30-Nov-84 08:17:30 EST References: <6114@brl-tgr.ARPA> Distribution: net Organization: Amdahl Corp, Sunnyvale CA Lines: 34 > = Doug Gwyn > > The following UNIX System V Release 2.0 commands have erroneous use > of utime(2) in their source code. On some systems, this can cause > files to have their dates set to funny values (like 31-Dec-1969). > > cpio file pack tar unpack The instances you refer to are of the form: char *filename; struct stat st; ... utime(filename, &st.st_atime); Despite its rather inelegant appearance, why should this fail? The second argument of utime(2) is expected to be the address of this kind of struct: struct utimbuf { time_t actime, modtime; } ubuf; Using the address of the st_atime field of a stat(2) struct would provide these values correctly, because the word following st_atime in the structure is st_mtime (the mod. time). Here's a picture: &st.st_atime -----> st_atime &ubuf -----> actime st_mtime modtime So is this really a bug, or is your C compiler acting strangely? -- Gordon A. Moffett ...!{ihnp4,hplabs,amd,sun}!amdahl!gam 37 22'50" N / 122 59'12" W [ This is just me talking. ]