Samba 2.0.6, MKS' touch.exe, and file/dir time stamps
Jeremy Allison
jeremy at valinux.com
Mon Dec 20 23:13:28 GMT 1999
Gert-Jan Vons wrote:
>
> Hello all,
>
> we are experiencing problems with samba 2.0.6 and the MKS touch command.
>
> during our builds, we touch files and directories so that our make
> dependencies work correctly. Unfortunately, it seems that MKS' touch.exe
> doesn't actually change the time stamp of a file or directory. The
> command returns without an error, but the timestamp does not change.
>
Paul Eggert just sent in a wonderful patch to fix this
correctly (I wish I had written it :-).
If you have had problems with timestamps being incorrectly
set with any Samba 2.0.x server I suggest you apply this
patch (which I have committed to the CVS tree) and let me
know if this fixes the problem.
Thanks (and a *big* thanks to Paul !),
Jeremy Allison,
Samba Team.
------------------cut here-------------------------------
Index: smbd/trans2.c
===================================================================
RCS file: /data/cvs/samba/source/smbd/trans2.c,v
retrieving revision 1.105.2.30
diff -u -r1.105.2.30 trans2.c
--- trans2.c 1999/11/24 00:15:45 1.105.2.30
+++ trans2.c 1999/12/20 21:40:41
@@ -1694,14 +1694,25 @@
case SMB_SET_FILE_BASIC_INFO:
{
+ /* Patch to do this correctly from Paul Eggert <eggert at twinsun.com>. */
+ time_t write_time;
+ time_t changed_time;
+
/* Ignore create time at offset pdata. */
/* access time */
tvs.actime = interpret_long_date(pdata+8);
+
+ write_time = interpret_long_date(pdata+16);
+ changed_time = interpret_long_date(pdata+24);
+
+ tvs.modtime = MAX(write_time, changed_time);
- /* write time + changed time, combined. */
- tvs.modtime=MIN(interpret_long_date(pdata+16),
- interpret_long_date(pdata+24));
+ /* Prefer a defined time to an undefined one. */
+ if (tvs.modtime == (time_t)0 || tvs.modtime == (time_t)-1)
+ tvs.modtime = (write_time == (time_t)0 || write_time == (time_t)-1
+ ? changed_time
+ : write_time);
#if 0 /* Needs more testing... */
/* Test from Luke to prevent Win95 from
------------------cut here-------------------------------
--
--------------------------------------------------------
Buying an operating system without source is like buying
a self-assembly Space Shuttle with no instructions.
--------------------------------------------------------
More information about the samba
mailing list