wl: fix sync pipe keepalive
All checks were successful
Test / Create distribution (push) Successful in 26s
Test / Fortify (push) Successful in 2m30s
Test / Fpkg (push) Successful in 3m36s
Test / Data race detector (push) Successful in 4m14s
Test / Flake checks (push) Successful in 59s

Signed-off-by: Ophestra <cat@gensokyo.uk>
This commit is contained in:
Ophestra 2025-03-25 01:33:37 +09:00
parent a9adcd914b
commit e732dca762
Signed by: cat
SSH Key Fingerprint: SHA256:gQ67O0enBZ7UdZypgtspB2FDM1g3GVw8nX0XSdcFw8Q
2 changed files with 5 additions and 5 deletions

View File

@ -94,7 +94,7 @@ func bindRawConn(done chan struct{}, rc syscall.RawConn, p, appID, instanceID st
// keep socket alive until done is requested // keep socket alive until done is requested
<-done <-done
runtime.KeepAlive(syncPipe[1].Fd()) runtime.KeepAlive(syncPipe[1])
}); err != nil { }); err != nil {
setupDone <- err setupDone <- err
} }
@ -107,7 +107,7 @@ func bindRawConn(done chan struct{}, rc syscall.RawConn, p, appID, instanceID st
return syncPipe[1], <-setupDone return syncPipe[1], <-setupDone
} }
func bind(fd uintptr, p, appID, instanceID string, syncFD uintptr) error { func bind(fd uintptr, p, appID, instanceID string, syncFd uintptr) error {
// ensure p is available // ensure p is available
if f, err := os.Create(p); err != nil { if f, err := os.Create(p); err != nil {
return err return err
@ -117,5 +117,5 @@ func bind(fd uintptr, p, appID, instanceID string, syncFD uintptr) error {
return err return err
} }
return bindWaylandFd(p, fd, appID, instanceID, syncFD) return bindWaylandFd(p, fd, appID, instanceID, syncFd)
} }

View File

@ -25,11 +25,11 @@ var resErr = [...]error{
2: errors.New("wp_security_context_v1 not available"), 2: errors.New("wp_security_context_v1 not available"),
} }
func bindWaylandFd(socketPath string, fd uintptr, appID, instanceID string, syncFD uintptr) error { func bindWaylandFd(socketPath string, fd uintptr, appID, instanceID string, syncFd uintptr) error {
if hasNull(appID) || hasNull(instanceID) { if hasNull(appID) || hasNull(instanceID) {
return ErrContainsNull return ErrContainsNull
} }
res := C.f_bind_wayland_fd(C.CString(socketPath), C.int(fd), C.CString(appID), C.CString(instanceID), C.int(syncFD)) res := C.f_bind_wayland_fd(C.CString(socketPath), C.int(fd), C.CString(appID), C.CString(instanceID), C.int(syncFd))
return resErr[int32(res)] return resErr[int32(res)]
} }