From f73a377ed0103b14690458dd07113e281e59d576 Mon Sep 17 00:00:00 2001 From: wlott <wlott> Date: Mon, 16 Dec 1991 12:48:45 +0000 Subject: [PATCH] Fixed OPEN to deal with the fact that UNIX-NAMESTRING can return NIL. --- code/fd-stream.lisp | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/code/fd-stream.lisp b/code/fd-stream.lisp index 77520a1e8..8224130ad 100644 --- a/code/fd-stream.lisp +++ b/code/fd-stream.lisp @@ -7,7 +7,7 @@ ;;; Scott Fahlman or slisp-group@cs.cmu.edu. ;;; (ext:file-comment - "$Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/code/fd-stream.lisp,v 1.17 1991/12/07 00:56:04 wlott Exp $") + "$Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/code/fd-stream.lisp,v 1.18 1991/12/16 12:48:45 wlott Exp $") ;;; ;;; ********************************************************************** ;;; @@ -1317,11 +1317,14 @@ non-server method is also significantly more efficient for large reads. ;; Determine if the file already exists, make sure the original ;; file is not a directory and keep the mode (let ((exists - (multiple-value-bind - (okay err/dev inode orig-mode) - (mach:unix-stat namestring) - (declare (ignore inode) (type (or index null) orig-mode)) - (cond (okay + (and namestring + (multiple-value-bind + (okay err/dev inode orig-mode) + (mach:unix-stat namestring) + (declare (ignore inode) + (type (or index null) orig-mode)) + (cond + (okay (when (and output (= (logand orig-mode #o170000) #o40000)) (error "Cannot open ~S for output: Is a directory." @@ -1333,7 +1336,7 @@ non-server method is also significantly more efficient for large reads. (t (error "Cannot find ~S: ~A" namestring - (mach:get-unix-error-msg err/dev))))))) + (mach:get-unix-error-msg err/dev)))))))) (unless (and exists (do-old-rename namestring original)) (setf original nil) @@ -1350,7 +1353,9 @@ non-server method is also significantly more efficient for large reads. (loop (multiple-value-bind (fd errno) - (mach:unix-open namestring mask mode) + (if namestring + (mach:unix-open namestring mask mode) + (values nil mach:enoent)) (cond ((numberp fd) (return (case direction -- GitLab