[libc-commits] [libc] [libc] Fix select tv_nsec conversion and tm_year overflow (PR #200425)

via libc-commits libc-commits at lists.llvm.org
Thu Jun 11 07:20:35 PDT 2026


================
@@ -27,3 +27,28 @@ TEST_F(LlvmLibcSelectTest, SelectInvalidFD) {
   ASSERT_THAT(LIBC_NAMESPACE::select(-1, &set, nullptr, nullptr, &timeout),
               Fails(EINVAL));
 }
+
+TEST_F(LlvmLibcSelectTest, SelectAcceptsLargeMicroseconds) {
+  int pipe_fds[2];
+  ASSERT_EQ(0, ::pipe(pipe_fds));
+
+  fd_set read_set;
+  FD_ZERO(&read_set);
+  FD_SET(pipe_fds[0], &read_set);
+
+  struct timeval timeout{
----------------
lntue wrote:

Yes, for headers that are also used for C, they are needed, but these are all in C++, and extra `struct`, especially like this case looks to me too close to defining a new struct type.  So for consistency with other simple structs, I'd prefer to drop the extra `struct`, unless it is needed to resolve ambiguity with functions or variables of the same name.

https://github.com/llvm/llvm-project/pull/200425


More information about the libc-commits mailing list