Don't use the `utime()' or `utimes()' system calls to touch files,
authorChris Hanson <org/chris-hanson/cph>
Thu, 3 Nov 1988 08:35:47 +0000 (08:35 +0000)
committerChris Hanson <org/chris-hanson/cph>
Thu, 3 Nov 1988 08:35:47 +0000 (08:35 +0000)
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
v7/src/microcode/version.h
v8/src/microcode/version.h

index 30e0d140ee437c856d06309062732e332e7040ed..a77f79335925e26678f2540e3a5388fdb225242a 100644 (file)
@@ -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"));
index 922d251e30c63ea6d37a8f6d817f23d4692650c1..b4c07e66a1824717f0a5f999249dcb5589a5ef65 100644 (file)
@@ -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
index 42335782aaf4353aa1ef7b5fca9e1c9b1588d230..6a27e0a88fe86d425b46e96e8a5fb09c6aa4f14d 100644 (file)
@@ -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