[vlc-devel] [PATCH 09/12] network: io: Remove VLA usages
Romain Vimont
rom1v at videolabs.io
Wed Dec 9 21:29:16 CET 2020
On Wed, Dec 09, 2020 at 12:19:58PM +0200, RĂ©mi Denis-Courmont wrote:
> Yeah those call sites! They'll busy loop, or cause their respective callers to, if you throw an ENOMEM error.
>
> I call that a bug. You can't have errors in event handling - other than events masquerading as errors (EINTR...) and call site bugs (EBADF, EINVAL...).
I think this is already the case. For example, this poll() could return
-1 with errno == ENOMEM:
https://code.videolan.org/videolan/vlc/-/blob/2dacb39432ad416f8a4adf4f7dfcbd900758019c/src/network/io.c#L326
In that case, net_Accept() returns -1.
Moreover, `man poll` says:
> On some other UNIX systems, poll() can fail with the error EAGAIN if
> the system fails to allocate kernel-internal resources, rather than
> ENOMEM as Linux does. POSIX permits this behavior. Portable programs
> may wish to check for EAGAIN and loop, just as with EINTR.
Regards
More information about the vlc-devel
mailing list