File tree Expand file tree Collapse file tree 1 file changed +6
-6
lines changed
src/uucore/src/lib/features Expand file tree Collapse file tree 1 file changed +6
-6
lines changed Original file line number Diff line number Diff line change @@ -159,11 +159,11 @@ impl ChildExt for Child {
159159 }
160160
161161 // Convert Duration to timespec for sigtimedwait
162- // Cap at i64 ::MAX to prevent overflow
163- const MAX_TIMESPEC_SECONDS : u64 = i64 :: MAX as u64 ;
162+ // Cap at time_t ::MAX to prevent overflow (time_t is i32 on 32-bit, i64 on 64-bit)
163+ const MAX_TIMESPEC_SECONDS : u64 = libc :: time_t :: MAX as u64 ;
164164 let timeout_spec = if timeout. as_secs ( ) >= MAX_TIMESPEC_SECONDS {
165165 libc:: timespec {
166- tv_sec : i64 :: MAX ,
166+ tv_sec : libc :: time_t :: MAX ,
167167 tv_nsec : 0 ,
168168 }
169169 } else {
@@ -268,11 +268,11 @@ impl ChildExt for Child {
268268 // Calculate timeout and deadline
269269 // Use checked_add to prevent overflow with very large timeouts
270270 let deadline = Instant :: now ( ) . checked_add ( timeout) ;
271- // Cap timeout at i64 ::MAX to prevent overflow in timespec conversion
272- const MAX_TIMESPEC_SECONDS : u64 = i64 :: MAX as u64 ;
271+ // Cap timeout at time_t ::MAX to prevent overflow in timespec conversion
272+ const MAX_TIMESPEC_SECONDS : u64 = libc :: time_t :: MAX as u64 ;
273273 let timeout_spec = if timeout. as_secs ( ) >= MAX_TIMESPEC_SECONDS {
274274 Some ( libc:: timespec {
275- tv_sec : i64 :: MAX ,
275+ tv_sec : libc :: time_t :: MAX ,
276276 tv_nsec : 0 ,
277277 } )
278278 } else {
You can’t perform that action at this time.
0 commit comments