Fix stupid bug in `file-writable?'.
authorChris Hanson <org/chris-hanson/cph>
Tue, 25 Apr 1989 01:04:43 +0000 (01:04 +0000)
committerChris Hanson <org/chris-hanson/cph>
Tue, 25 Apr 1989 01:04:43 +0000 (01:04 +0000)
v7/src/runtime/unxprm.scm

index 237d5daca07258f405f9dc3f9e31fc9f5f5449c9..7bc108ba78a0e2b593946166769d0930462f6c73 100644 (file)
@@ -1,6 +1,6 @@
 #| -*-Scheme-*-
 
-$Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/runtime/unxprm.scm,v 1.3 1989/04/24 23:45:23 cph Exp $
+$Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/runtime/unxprm.scm,v 1.4 1989/04/25 01:04:43 cph Rel $
 
 Copyright (c) 1988, 1989 Massachusetts Institute of Technology
 
@@ -60,9 +60,12 @@ MIT in each case. |#
 
 (define (file-writable? filename)
   (let ((pathname (pathname->absolute-pathname (->pathname filename))))
-    (or ((ucode-primitive file-access) (pathname->string pathname) 2)
-       ((ucode-primitive file-access) (pathname-directory-string pathname)
-                                      2))))
+    (let ((filename (pathname->string pathname)))
+      (or ((ucode-primitive file-access) filename 2)
+         (and (not ((ucode-primitive file-exists?) filename))
+              ((ucode-primitive file-access)
+               (pathname-directory-string pathname)
+               2))))))
 
 (define (file-attributes filename)
   ((ucode-primitive file-attributes)