Skip to content

Commit

Permalink
Merge pull request #1537 from shirou/feat/fix_darwin_host_users
Browse files Browse the repository at this point in the history
[host][darwin]: fix Users
  • Loading branch information
shirou committed Oct 22, 2023
2 parents 4ad4406 + 4b46f2b commit c020a08
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
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
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 c020a08

Please sign in to comment.