Skip to content
Snippets Groups Projects
Commit f73a377e authored by wlott's avatar wlott
Browse files

Fixed OPEN to deal with the fact that UNIX-NAMESTRING can return NIL.

parent f5861713
No related branches found
No related tags found
No related merge requests found
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
;;; Scott Fahlman or slisp-group@cs.cmu.edu. ;;; Scott Fahlman or slisp-group@cs.cmu.edu.
;;; ;;;
(ext:file-comment (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. ...@@ -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 ;; Determine if the file already exists, make sure the original
;; file is not a directory and keep the mode ;; file is not a directory and keep the mode
(let ((exists (let ((exists
(multiple-value-bind (and namestring
(okay err/dev inode orig-mode) (multiple-value-bind
(mach:unix-stat namestring) (okay err/dev inode orig-mode)
(declare (ignore inode) (type (or index null) orig-mode)) (mach:unix-stat namestring)
(cond (okay (declare (ignore inode)
(type (or index null) orig-mode))
(cond
(okay
(when (and output (= (logand orig-mode #o170000) (when (and output (= (logand orig-mode #o170000)
#o40000)) #o40000))
(error "Cannot open ~S for output: Is a directory." (error "Cannot open ~S for output: Is a directory."
...@@ -1333,7 +1336,7 @@ non-server method is also significantly more efficient for large reads. ...@@ -1333,7 +1336,7 @@ non-server method is also significantly more efficient for large reads.
(t (t
(error "Cannot find ~S: ~A" (error "Cannot find ~S: ~A"
namestring namestring
(mach:get-unix-error-msg err/dev))))))) (mach:get-unix-error-msg err/dev))))))))
(unless (and exists (unless (and exists
(do-old-rename namestring original)) (do-old-rename namestring original))
(setf original nil) (setf original nil)
...@@ -1350,7 +1353,9 @@ non-server method is also significantly more efficient for large reads. ...@@ -1350,7 +1353,9 @@ non-server method is also significantly more efficient for large reads.
(loop (loop
(multiple-value-bind (multiple-value-bind
(fd errno) (fd errno)
(mach:unix-open namestring mask mode) (if namestring
(mach:unix-open namestring mask mode)
(values nil mach:enoent))
(cond ((numberp fd) (cond ((numberp fd)
(return (return
(case direction (case direction
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment