Skip to content

Commit 4b46f2b

Browse files
committed
[host][darwin]: fix Users
1 parent 5ee64c6 commit 4b46f2b

File tree

2 files changed

+4
-0
lines changed

2 files changed

+4
-0
lines changed

host/host_darwin.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,9 @@ func UsersWithContext(ctx context.Context) ([]UserStat, error) {
6464
return ret, err
6565
}
6666

67+
// Skip macOS utmpx header part
68+
buf = buf[604:]
69+
6770
u := Utmpx{}
6871
entrySize := int(unsafe.Sizeof(u))
6972
count := len(buf) / entrySize

host/host_test.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,7 @@ func TestUsers(t *testing.T) {
8989
if u == empty {
9090
t.Errorf("Could not Users %v", v)
9191
}
92+
t.Log(u)
9293
}
9394
}
9495

0 commit comments

Comments
 (0)