Commit 33b983daef0b7610e9f378651a81cac8d48a810a

Thomas de Grivel 2018-04-17T15:49:17

update open

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
diff --git a/unistd-stream-open.lisp b/unistd-stream-open.lisp
index d993f83..70b815f 100644
--- a/unistd-stream-open.lisp
+++ b/unistd-stream-open.lisp
@@ -28,8 +28,10 @@
           "Open not for reading nor writing.")
   (let* ((flags (compute-flags read write append non-blocking create))
          (fd (fcntl:open pathname flags (or create 0)))
-         (class (compute-class read write)))
-    (make-instance class
-                   :fd fd
-                   :input-buffer-size input-buffer-size
-                   :output-buffer-size output-buffer-size)))
+         (class (compute-class read write))
+         (args ()))
+    (when read
+      (setf args (list* :input-buffer-size input-buffer-size args)))
+    (when write
+      (setf args (list* :output-buffer-size output-buffer-size args)))
+    (apply #'make-instance class :fd fd args)))