Skip to content

Commit

Permalink
[host][darwin]: fix Users
Browse files Browse the repository at this point in the history
  • Loading branch information
shirou committed Oct 10, 2023
1 parent 5ee64c6 commit 4b46f2b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
3 changes: 3 additions & 0 deletions host/host_darwin.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,9 @@ func UsersWithContext(ctx context.Context) ([]UserStat, error) {
return ret, err
}

// Skip macOS utmpx header part
buf = buf[604:]

u := Utmpx{}
entrySize := int(unsafe.Sizeof(u))
count := len(buf) / entrySize
Expand Down
1 change: 1 addition & 0 deletions host/host_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ func TestUsers(t *testing.T) {
if u == empty {
t.Errorf("Could not Users %v", v)
}
t.Log(u)
}
}

Expand Down

0 comments on commit 4b46f2b

Please sign in to comment.