epoll_create: fail with EINVAL if size is non-positive
authorKristina Martsenko <kristina.martsenko@arm.com>
Wed, 24 Aug 2022 14:26:52 +0000 (15:26 +0100)
committerRich Felker <dalias@aerifal.cx>
Thu, 25 Aug 2022 00:35:47 +0000 (20:35 -0400)
This is a part of the interface contract defined in the Linux man
page (official for a Linux-specific interface) and asserted by test
cases in the Linux Test Project (LTP).

src/linux/epoll.c

index 93baa81..e56e8f4 100644 (file)
@@ -5,6 +5,7 @@
 
 int epoll_create(int size)
 {
+       if (size<=0) return __syscall_ret(-EINVAL);
        return epoll_create1(0);
 }