From 3df5bfc98b7c61caefb350499cc3c9f879e77d63 Mon Sep 17 00:00:00 2001 From: Jonas Rinke Date: Fri, 17 Oct 2025 22:15:28 +0200 Subject: [PATCH] Allow fd zero as return value from `socket` --- unix-socket-lib/racket/unix-socket.rkt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/unix-socket-lib/racket/unix-socket.rkt b/unix-socket-lib/racket/unix-socket.rkt index c59d2fd..8393ac8 100644 --- a/unix-socket-lib/racket/unix-socket.rkt +++ b/unix-socket-lib/racket/unix-socket.rkt @@ -64,7 +64,7 @@ ;; Should be called in atomic mode. (define (do-make-socket who) (define socket-fd (socket AF-UNIX SOCK-STREAM 0)) - (unless (positive? socket-fd) + (when (negative? socket-fd) (error who "failed to create socket~a" (errno-error-lines (saved-errno)))) (set-fd-nonblocking who socket-fd) @@ -160,7 +160,7 @@ ;; Non-blocking connect may succeed immediately or require waiting to see. ;; - If succeeds immediately, make ports in same atomic block ;; - If wait, must exit atomic mode to sync - ;; So we return a procedure to be applied in non-atomic mode that does + ;; So we return a procedure to be applied in non-atomic mode that does ;; whatever needs doing. (call-as-atomic (lambda ()