[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#55223: Shepherd 0.9.0 ‘make-inetd-constructor’ can leak file descrip
From: |
Ludovic Courtès |
Subject: |
bug#55223: Shepherd 0.9.0 ‘make-inetd-constructor’ can leak file descriptors |
Date: |
Mon, 02 May 2022 23:11:45 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux) |
Ludovic Courtès <ludovic.courtes@inria.fr> skribis:
> ‘make-inetd-constructor’ creates a socket and then calls bind(2) on it.
>
> (lambda args
> (let ((sock (non-blocking-port
> (socket (sockaddr:fam address) socket-style 0)))
> […])
> (setsockopt sock SOL_SOCKET SO_REUSEADDR 1)
> […]
> (bind sock address)
>
> If bind(2) fails, for instance with EADDRINUSE, the socket it created is
> leaked; it will be closed “eventually”, when GC runs, but that could
> happen much later.
Fixed in Shepherd commit b4a30a309f0e9451a671691b19fa7a5e1ef92b69.
Ludo’.