[libc-commits] [libc] [libc] Fix utimes build when full_build=OFF (PR #149668)
Mikhail R. Gadelha via libc-commits
libc-commits at lists.llvm.org
Sat Jul 19 10:50:47 PDT 2025
https://github.com/mikhailramalho created https://github.com/llvm/llvm-project/pull/149668
Same as PR #149665: we might pull a header from the host where tv_nsec is not a long, so compilation would fail with an implicit conversion error.
>From 6780c259cf2b5a89804a659c5e680a2c8801a012 Mon Sep 17 00:00:00 2001
From: "Mikhail R. Gadelha" <mikhail at igalia.com>
Date: Sat, 19 Jul 2025 14:47:41 -0300
Subject: [PATCH] [libc] Fix utimes build when full_build=OFF
Same as PR #149665: we might pull a header from host where tv_nsec is
not a long, so compilation would fail with an implicit conversion error.
---
libc/src/sys/time/linux/utimes.cpp | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/libc/src/sys/time/linux/utimes.cpp b/libc/src/sys/time/linux/utimes.cpp
index ed37b42aedf6c..36220d73e7c19 100644
--- a/libc/src/sys/time/linux/utimes.cpp
+++ b/libc/src/sys/time/linux/utimes.cpp
@@ -59,8 +59,8 @@ LLVM_LIBC_FUNCTION(int, utimes,
ts[1].tv_sec = times[1].tv_sec;
// convert u-seconds to nanoseconds
- ts[0].tv_nsec = times[0].tv_usec * 1000;
- ts[1].tv_nsec = times[1].tv_usec * 1000;
+ ts[0].tv_nsec = static_cast<decltype(ts[0].tv_nsec)>(times[0].tv_usec * 1000);
+ ts[1].tv_nsec = static_cast<decltype(ts[1].tv_nsec)>(times[1].tv_usec * 1000);
ts_ptr = ts;
}
More information about the libc-commits
mailing list