From cef4ce3a37781309ddd4c84e4c8abc7d49d0c7fc Mon Sep 17 00:00:00 2001 From: Chris Hanson Date: Thu, 3 Nov 1988 08:35:47 +0000 Subject: [PATCH] Don't use the `utime()' or `utimes()' system calls to touch files, because they are subject to clock skew problems when used on remote NFS files. Also, add check for file type to file touching code. --- v7/src/microcode/pruxfs.c | 13 ++++++++++++- v7/src/microcode/version.h | 4 ++-- v8/src/microcode/version.h | 4 ++-- 3 files changed, 16 insertions(+), 5 deletions(-) diff --git a/v7/src/microcode/pruxfs.c b/v7/src/microcode/pruxfs.c index 30e0d140e..a77f79335 100644 --- a/v7/src/microcode/pruxfs.c +++ b/v7/src/microcode/pruxfs.c @@ -1,6 +1,6 @@ /* -*-C-*- -$Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/microcode/pruxfs.c,v 9.31 1988/10/20 11:00:08 cph Exp $ +$Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/microcode/pruxfs.c,v 9.32 1988/11/03 08:35:21 cph Exp $ Copyright (c) 1987, 1988 Massachusetts Institute of Technology @@ -489,6 +489,7 @@ file_touch (filename) extern int stat (); extern int write (); +#if 0 #ifdef bsd extern long time (); long current_time; @@ -499,6 +500,7 @@ file_touch (filename) extern int utime (); #endif /* hpux */ #endif /* bsd */ +#endif /* 0 */ /* CASE 1: create the file if it doesn't exist. */ result = (stat (filename, (& file_status))); @@ -513,6 +515,10 @@ file_touch (filename) goto zero_length_file; } +#if 0 + /* Disable this code -- this is subject to clock skew problems + when the file is on an NFS server. */ + /* CASE 2: try utime (utimes) if it's available. */ #ifdef bsd @@ -534,9 +540,14 @@ file_touch (filename) #endif /* hpux */ #endif /* bsd */ +#endif /* 0 */ /* utime (utimes) has failed, or does not exist. Instead, open the file, read one byte, and write it back in place. */ + + if (((file_status . st_mode) & S_IFMT) != S_IFREG) + return (C_String_To_Scheme_String ("can only touch regular files")); + fd = (open (filename, O_RDWR, 0666)); if (fd < 0) return (system_error_message ("open")); diff --git a/v7/src/microcode/version.h b/v7/src/microcode/version.h index 922d251e3..b4c07e66a 100644 --- a/v7/src/microcode/version.h +++ b/v7/src/microcode/version.h @@ -1,6 +1,6 @@ /* -*-C-*- -$Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/microcode/Attic/version.h,v 10.59 1988/10/27 05:22:48 cph Exp $ +$Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/microcode/Attic/version.h,v 10.60 1988/11/03 08:35:47 cph Exp $ Copyright (c) 1988 Massachusetts Institute of Technology @@ -46,7 +46,7 @@ MIT in each case. */ #define VERSION 10 #endif #ifndef SUBVERSION -#define SUBVERSION 59 +#define SUBVERSION 60 #endif #ifndef UCODE_TABLES_FILENAME diff --git a/v8/src/microcode/version.h b/v8/src/microcode/version.h index 42335782a..6a27e0a88 100644 --- a/v8/src/microcode/version.h +++ b/v8/src/microcode/version.h @@ -1,6 +1,6 @@ /* -*-C-*- -$Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v8/src/microcode/version.h,v 10.59 1988/10/27 05:22:48 cph Exp $ +$Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v8/src/microcode/version.h,v 10.60 1988/11/03 08:35:47 cph Exp $ Copyright (c) 1988 Massachusetts Institute of Technology @@ -46,7 +46,7 @@ MIT in each case. */ #define VERSION 10 #endif #ifndef SUBVERSION -#define SUBVERSION 59 +#define SUBVERSION 60 #endif #ifndef UCODE_TABLES_FILENAME -- 2.25.1