Skip to content

Commit f6d19fa

Browse files
committed
uptime: use same code structure in two blocks
1 parent 52a2b66 commit f6d19fa

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

src/uu/uptime/src/uptime.rs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -194,17 +194,16 @@ fn uptime_with_file(file_path: &std::ffi::OsString) -> UResult<()> {
194194

195195
#[cfg(target_os = "openbsd")]
196196
{
197-
user_count = get_nusers(file_path.to_str().expect("invalid utmp path file"));
198-
199197
let upsecs = get_uptime(None);
200-
if upsecs < 0 {
198+
if upsecs >= 0 {
199+
print_uptime(Some(upsecs))?;
200+
} else {
201201
show_error!("couldn't get boot time");
202202
set_exit_code(1);
203203

204204
print!("up ???? days ??:??,");
205-
} else {
206-
print_uptime(Some(upsecs))?;
207205
}
206+
user_count = get_nusers(file_path.to_str().expect("invalid utmp path file"));
208207
}
209208

210209
print_nusers(Some(user_count));

0 commit comments

Comments
 (0)