Index: l1-sockets.lisp =================================================================== --- l1-sockets.lisp (wersja 12001) +++ l1-sockets.lisp (kopia robocza) @@ -604,7 +604,8 @@ local-port local-host backlog class out-of-band-inline local-filename remote-filename sharing basic external-format (auto-close t) - connect-timeout input-timeout output-timeout deadline) + connect-timeout input-timeout output-timeout deadline + fd) "Create and return a new socket." (declare (dynamic-extent keys)) (declare (ignore type connect remote-host remote-port eol format @@ -618,11 +619,12 @@ -(defun make-udp-socket (&rest keys &aux (fd -1)) +(defun make-udp-socket (&rest keys &key (fd -1) &allow-other-keys) (unwind-protect (let (socket) - (setq fd (socket-call nil "socket" - (c_socket #$AF_INET #$SOCK_DGRAM #$IPPROTO_UDP))) + (when (< fd 0) + (setq fd (socket-call nil "socket" + (c_socket #$AF_INET #$SOCK_DGRAM #$IPPROTO_UDP)))) (apply #'set-socket-options fd keys) (setq socket (make-instance 'udp-socket :device fd @@ -632,11 +634,12 @@ (unless (< fd 0) (fd-close fd)))) -(defun make-tcp-socket (&rest keys &key connect &allow-other-keys &aux (fd -1)) +(defun make-tcp-socket (&rest keys &key connect (fd -1) &allow-other-keys) (unwind-protect (let (socket) - (setq fd (socket-call nil "socket" - (c_socket #$AF_INET #$SOCK_STREAM #$IPPROTO_TCP))) + (when (< fd 0) + (setq fd (socket-call nil "socket" + (c_socket #$AF_INET #$SOCK_STREAM #$IPPROTO_TCP)))) (apply #'set-socket-options fd keys) (setq socket (ecase connect @@ -647,10 +650,11 @@ (unless (< fd 0) (fd-close fd)))) -(defun make-stream-file-socket (&rest keys &key connect &allow-other-keys &aux (fd -1)) +(defun make-stream-file-socket (&rest keys &key connect (fd -1) &allow-other-keys) (unwind-protect (let (socket) - (setq fd (socket-call nil "socket" (c_socket #$PF_LOCAL #$SOCK_STREAM 0))) + (when (< fd 0) + (setq fd (socket-call nil "socket" (c_socket #$PF_LOCAL #$SOCK_STREAM 0)))) (apply #'set-socket-options fd keys) (setq socket (ecase connect