Commit 843ac36a69c25469bca9fd730c757857b40dc673

Thomas de Grivel 2018-04-27T14:47:42

fix open create mode

diff --git a/unistd-stream-open.lisp b/unistd-stream-open.lisp
index 70b815f..61da218 100644
--- a/unistd-stream-open.lisp
+++ b/unistd-stream-open.lisp
@@ -15,10 +15,15 @@
         (read             'unistd-input-stream)
         (write            'unistd-output-stream)))
 
+(defun compute-mode (create)
+  (cond ((null create) nil)
+        ((eq t create) #o666)
+        (t create)))
+
 (defun unistd-stream-open (pathname &key
                                       read write append
                                       non-blocking
-                                      (create #o777)
+                                      (create #o666)
                                       (input-buffer-size
                                        *stream-default-buffer-size*)
                                       (output-buffer-size
@@ -27,7 +32,8 @@
           (read write)
           "Open not for reading nor writing.")
   (let* ((flags (compute-flags read write append non-blocking create))
-         (fd (fcntl:open pathname flags (or create 0)))
+         (mode (compute-mode create))
+         (fd (fcntl:open pathname flags mode))
          (class (compute-class read write))
          (args ()))
     (when read