[libc-commits] [libc] [libc] Fix select tv_nsec conversion and tm_year overflow (PR #200425)
Pavel Labath via libc-commits
libc-commits at lists.llvm.org
Fri Jun 5 06:36:16 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{
----------------
labath wrote:
Technically, I guess no, but I've recently fixed a bug where the a struct was declared incorrectly (`struct foo ...` vs. `typedef struct ... foo;` C++ doesn't care about the difference between the two (you can use `foo` to refer to both), but this caused C programs using `struct foo` to not build.
By using `struct foo` we're also kind of also testing that the structure is defined correctly. (Personally, I also just like using `struct foo` to refer to C entities :) ).
https://github.com/llvm/llvm-project/pull/200425
More information about the libc-commits
mailing list