diff options
| author | Ophestra <cat@gensokyo.uk> | 2025-11-16 01:45:37 +0900 |
|---|---|---|
| committer | Ophestra <cat@gensokyo.uk> | 2025-11-16 01:45:37 +0900 |
| commit | 00771efeb46b5828aad6aabc42dca779905ae171 (patch) | |
| tree | 63ea2f368a522616f679d77257e3db442254601c /internal/wayland/conn.go | |
| parent | 61972d61f650be2fb86eb2ead452b74c02b3e00f (diff) | |
internal/wayland: remove fd typecasts
These are no longer necessary since RawConn is no longer used.
Signed-off-by: Ophestra <cat@gensokyo.uk>
Diffstat (limited to 'internal/wayland/conn.go')
| -rw-r--r-- | internal/wayland/conn.go | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/internal/wayland/conn.go b/internal/wayland/conn.go index c861c05f..17ddae8d 100644 --- a/internal/wayland/conn.go +++ b/internal/wayland/conn.go @@ -49,7 +49,7 @@ func New(displayPath, bindPath *check.Absolute, appID, instanceID string) (*Secu _ = syscall.Close(fd) return nil, &Error{RHostConnect, err} } else { - closeFds, bindErr := bindSecurityContext(fd, bindPath, appID, instanceID) + closeFds, bindErr := securityContextBindPipe(fd, bindPath, appID, instanceID) if bindErr != nil { // do not leak the pipe and socket err = errors.Join(bindErr, // already wrapped @@ -62,11 +62,15 @@ func New(displayPath, bindPath *check.Absolute, appID, instanceID string) (*Secu } } -// bindSecurityContext binds a socket associated to a security context created on serverFd, +// securityContextBindPipe binds a socket associated to a security context created on serverFd, // returning the pipe file descriptors used for security-context-v1 close_fd. // // A non-nil error unwraps to concrete type [Error]. -func bindSecurityContext(serverFd int, bindPath *check.Absolute, appID, instanceID string) ([2]int, error) { +func securityContextBindPipe( + serverFd int, + bindPath *check.Absolute, + appID, instanceID string, +) ([2]int, error) { // write end passed to security-context-v1 close_fd var closeFds [2]int if err := syscall.Pipe2(closeFds[0:], syscall.O_CLOEXEC); err != nil { @@ -74,7 +78,12 @@ func bindSecurityContext(serverFd int, bindPath *check.Absolute, appID, instance } // returned error is already wrapped - if err := bindWaylandFd(bindPath.String(), uintptr(serverFd), appID, instanceID, uintptr(closeFds[1])); err != nil { + if err := securityContextBind( + bindPath.String(), + serverFd, + appID, instanceID, + closeFds[1], + ); err != nil { return closeFds, errors.Join(err, syscall.Close(closeFds[1]), syscall.Close(closeFds[0]), |
