Rewrite unix file opening code to be really careful about what kinds
authorChris Hanson <org/chris-hanson/cph>
Sat, 12 Nov 1988 06:47:24 +0000 (06:47 +0000)
committerChris Hanson <org/chris-hanson/cph>
Sat, 12 Nov 1988 06:47:24 +0000 (06:47 +0000)
of files can be opened, and how.  As of now, only regular files and
character special files are allowed; symbolic links are detected when
opening output files and deleted, thus overwriting the link rather
than writing through it.

Implement new primitive `file-flush-output' which is needed since we
changed file I/O to use buffered stdio some time ago.

v7/src/microcode/pruxfs.c
v7/src/microcode/version.h
v8/src/microcode/version.h

index a77f79335925e26678f2540e3a5388fdb225242a..0d5cc16c2859afd79cdc729366db3bf44af35d89 100644 (file)
@@ -1,6 +1,6 @@
 /* -*-C-*-
 
-$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 $
+$Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/microcode/pruxfs.c,v 9.33 1988/11/12 06:47:10 cph Exp $
 
 Copyright (c) 1987, 1988 Massachusetts Institute of Technology
 
@@ -390,16 +390,16 @@ the result is #F.")
 
 static void
 filemodestring (s, a)
-   struct stat *s;
-   char *a;
+   struct stat * s;
+   char * a;
 {
   extern char file_type_letter ();
 
   (a [0]) = (file_type_letter (s));
   /* Aren't there symbolic names for these byte-fields? */
-  rwx (((s -> st_mode) & 0700) << 0, (& (a [1])));
-  rwx (((s -> st_mode) & 0070) << 3, (& (a [4])));
-  rwx (((s -> st_mode) & 0007) << 6, (& (a [7])));
+  rwx ((((s -> st_mode) & 0700) << 0), (& (a [1])));
+  rwx ((((s -> st_mode) & 0070) << 3), (& (a [4])));
+  rwx ((((s -> st_mode) & 0007) << 6), (& (a [7])));
   setst ((s -> st_mode), a);
   return;
 }
@@ -412,9 +412,10 @@ rwx (bits, chars)
    unsigned short bits;
    char chars[];
 {
-  chars[0] = (bits & S_IREAD)  ? 'r' : '-';
-  chars[1] = (bits & S_IWRITE) ? 'w' : '-';
-  chars[2] = (bits & S_IEXEC)  ? 'x' : '-';
+  (chars [0]) = ((bits & S_IREAD)  ? 'r' : '-');
+  (chars [1]) = ((bits & S_IWRITE) ? 'w' : '-');
+  (chars [2]) = ((bits & S_IEXEC)  ? 'x' : '-');
+  return;
 }
 
 /* setst - set s & t flags in a file attributes string */
@@ -426,28 +427,17 @@ setst (bits, chars)
 {
 #ifdef S_ISUID
    if (bits & S_ISUID)
-     {
-       if (chars[3] != 'x')
-        /* Screw case: set-uid, but not executable. */
-        chars[3] = 'S';
-       else
-        chars[3] = 's';
-     }
+     (chars [3]) = (((chars [3]) == 'x') ? 's' : 'S');
 #endif
 #ifdef S_ISGID
    if (bits & S_ISGID)
-     {
-       if (chars[6] != 'x')
-        /* Screw case: set-gid, but not executable. */
-        chars[6] = 'S';
-       else
-        chars[6] = 's';
-     }
+     (chars [6]) = (((chars [6]) == 'x') ? 's' : 'S');
 #endif
 #ifdef S_ISVTX
    if (bits & S_ISVTX)
-      chars[9] = 't';
+     (chars [9]) = (((chars [9]) == 'x') ? 't' : 'T');
 #endif
+   return;
 }
 \f
 DEFINE_PRIMITIVE ("SYSTEM", Prim_system, 1, 1,
index 7d1124e2b6494af86fb8b0d65b79c83f75dce410..e8b9615999c6d4785195b398d6dee4425f63df4b 100644 (file)
@@ -1,6 +1,6 @@
 /* -*-C-*-
 
-$Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/microcode/Attic/version.h,v 10.62 1988/11/10 06:13:19 jinx Exp $
+$Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/microcode/Attic/version.h,v 10.63 1988/11/12 06:47:24 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     62
+#define SUBVERSION     63
 #endif
 
 #ifndef UCODE_TABLES_FILENAME
index 48ffd73b4bbfe7dc241208f81692f035ac0f0b58..6156f1ab5ce5eb1b2473fc2abdbf343bd842b29a 100644 (file)
@@ -1,6 +1,6 @@
 /* -*-C-*-
 
-$Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v8/src/microcode/version.h,v 10.62 1988/11/10 06:13:19 jinx Exp $
+$Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v8/src/microcode/version.h,v 10.63 1988/11/12 06:47:24 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     62
+#define SUBVERSION     63
 #endif
 
 #ifndef UCODE_TABLES_FILENAME