aboutsummaryrefslogtreecommitdiffhomepage
path: root/internal/pipewire/securitycontext.go
diff options
context:
space:
mode:
authorOphestra <cat@gensokyo.uk>2026-10-27 20:23:12 +0900
committerOphestra <cat@gensokyo.uk>2026-10-27 20:23:12 +0900
commita220c1b7aeb5a03fab3172a9ad17afcc1868e26c (patch)
treecd553da950d353202cee77e65364d109aa66f8d8 /internal/pipewire/securitycontext.go
parentea29e6bad114306b78820cb674863a9bf3041fa5 (diff)
internal/pipewire: improve path error reporting
This replaces SyscallError with PathError when pathnames are involved. Signed-off-by: Ophestra <cat@gensokyo.uk>
Diffstat (limited to 'internal/pipewire/securitycontext.go')
-rw-r--r--internal/pipewire/securitycontext.go22
1 files changed, 18 insertions, 4 deletions
diff --git a/internal/pipewire/securitycontext.go b/internal/pipewire/securitycontext.go
index f277a99e..06e8c448 100644
--- a/internal/pipewire/securitycontext.go
+++ b/internal/pipewire/securitycontext.go
@@ -192,14 +192,24 @@ func (securityContext *SecurityContext) BindAndCreate(pathname string, props SPA
scc.pathname = pathname
var listenFd int
- if fd, err := syscall.Socket(syscall.AF_UNIX, syscall.SOCK_STREAM|syscall.SOCK_CLOEXEC, 0); err != nil {
+ if fd, err := syscall.Socket(
+ syscall.AF_UNIX,
+ syscall.SOCK_STREAM|syscall.SOCK_CLOEXEC,
+ 0,
+ ); err != nil {
return nil, os.NewSyscallError("socket", err)
} else {
securityContext.ctx.cleanup(func() error { return syscall.Close(fd) })
listenFd = fd
}
- if err := syscall.Bind(listenFd, &syscall.SockaddrUnix{Name: pathname}); err != nil {
- return nil, os.NewSyscallError("bind", err)
+ if err := syscall.Bind(listenFd, &syscall.SockaddrUnix{
+ Name: pathname,
+ }); err != nil {
+ return nil, &os.PathError{
+ Op: "bind",
+ Path: pathname,
+ Err: err,
+ }
} else if err = syscall.Listen(listenFd, 0); err != nil {
_ = os.Remove(pathname)
return nil, os.NewSyscallError("listen", err)
@@ -211,7 +221,11 @@ func (securityContext *SecurityContext) BindAndCreate(pathname string, props SPA
}
runtime.SetFinalizer(&scc, (*securityContextCloser).Close)
- if err := securityContext.Create(listenFd, scc.closeFds[1], props); err != nil {
+ if err := securityContext.Create(
+ listenFd,
+ scc.closeFds[1],
+ props,
+ ); err != nil {
_ = scc.Close()
return nil, err
}