Skip to content

Commit

Permalink
unix: fix IoctlGetPtmget get empty ptsname on NetBSD.
Browse files Browse the repository at this point in the history
On NetBSD, because the size of the Ptmget structure does not match the value of TIOCPTSNAME, IoctlGetPtmget uses an incorrect structure internally, resulting in empty ptsname.

See https://github.com/NetBSD/src/blob/trunk/sys/sys/ttycom.h

Fixes #66871
  • Loading branch information
iyzyi committed Apr 17, 2024
1 parent 9a28524 commit 683f056
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 7 deletions.
7 changes: 6 additions & 1 deletion unix/syscall_netbsd_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,12 @@ func TestIoctlPtmget(t *testing.T) {
t.Fatalf("IoctlGetPtmget: %v\n", err)
}

t.Logf("sfd = %v, ptsname = %v", ptm.Sfd, unix.ByteSliceToString(ptm.Sn[:]))
ptsname := unix.ByteSliceToString(ptm.Sn[:])
if ptsname == "" {
t.Fatalf("IoctlGetPtmget: ptsname is empty string\n")
}

t.Logf("sfd = %v, ptsname = %v", ptm.Sfd, ptsname)
}

func TestStatvfs(t *testing.T) {
Expand Down
4 changes: 2 additions & 2 deletions unix/ztypes_netbsd_386.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions unix/ztypes_netbsd_amd64.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions unix/ztypes_netbsd_arm64.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 683f056

Please sign in to comment.