Skip to content

Commit 5bf4526

Browse files
authored
Merge branch 'main' into wc-stdin-metadata-optimization
2 parents 9a48cac + 3fbfcf9 commit 5bf4526

3 files changed

Lines changed: 16 additions & 8 deletions

File tree

.github/workflows/ignore-intermittent.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ tests/expand/bounded-memory
55
tests/pr/bounded-memory
66
tests/tail/inotify-dir-recreate
77
tests/tail/overlay-headers
8+
tests/tail/tail-n0f
9+
tests/tail/pipe-f
810
tests/timeout/timeout
911
tests/tail/symlink
1012
tests/shuf/shuf-reservoir

src/uu/uptime/src/uptime.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,9 @@
55

66
// spell-checker:ignore getloadavg behaviour loadavg uptime upsecs updays upmins uphours boottime nusers utmpxname gettime clockid couldnt
77

8-
use clap::{Arg, ArgAction, Command, ValueHint, builder::ValueParser};
8+
use clap::{Arg, ArgAction, Command};
9+
#[cfg(unix)]
10+
use clap::{ValueHint, builder::ValueParser};
911
use jiff::tz::TimeZone;
1012
use jiff::{Timestamp, ToSpan};
1113
#[cfg(unix)]

src/uucore/src/lib/features/uptime.rs

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -253,6 +253,7 @@ impl FormattedUptime {
253253
///
254254
/// Returns a UResult with the uptime in seconds if successful, otherwise an UptimeError.
255255
#[cfg(windows)]
256+
#[allow(clippy::unnecessary_wraps, reason = "needed on some platforms")]
256257
pub fn get_uptime(_boot_time: Option<time_t>) -> UResult<i64> {
257258
use windows_sys::Win32::System::SystemInformation::GetTickCount;
258259
// SAFETY: always return u32
@@ -345,7 +346,10 @@ pub fn get_nusers(file: &str) -> usize {
345346
#[cfg(target_os = "windows")]
346347
pub fn get_nusers() -> usize {
347348
use std::ptr;
348-
use windows_sys::Win32::System::RemoteDesktop::*;
349+
use windows_sys::Win32::System::RemoteDesktop::{
350+
WTS_CURRENT_SERVER_HANDLE, WTSEnumerateSessionsW, WTSFreeMemory,
351+
WTSQuerySessionInformationW,
352+
};
349353

350354
let mut num_user = 0;
351355

@@ -358,8 +362,8 @@ pub fn get_nusers() -> usize {
358362
WTS_CURRENT_SERVER_HANDLE,
359363
0,
360364
1,
361-
&mut session_info_ptr,
362-
&mut session_count,
365+
&raw mut session_info_ptr,
366+
&raw mut session_count,
363367
);
364368
if result == 0 {
365369
return 0;
@@ -375,8 +379,8 @@ pub fn get_nusers() -> usize {
375379
WTS_CURRENT_SERVER_HANDLE,
376380
session.SessionId,
377381
5,
378-
&mut buffer,
379-
&mut bytes_returned,
382+
&raw mut buffer,
383+
&raw mut bytes_returned,
380384
);
381385
if result == 0 || buffer.is_null() {
382386
continue;
@@ -387,10 +391,10 @@ pub fn get_nusers() -> usize {
387391
num_user += 1;
388392
}
389393

390-
WTSFreeMemory(buffer as _);
394+
WTSFreeMemory(buffer.cast());
391395
}
392396

393-
WTSFreeMemory(session_info_ptr as _);
397+
WTSFreeMemory(session_info_ptr.cast());
394398
}
395399

396400
num_user

0 commit comments

Comments
 (0)