fortify: keep external files alive
This should eliminate sporadic failures, like the known double close in "seccomp". Signed-off-by: Ophestra <cat@gensokyo.uk>
This commit is contained in:
@@ -94,6 +94,7 @@ func bindRawConn(done chan struct{}, rc syscall.RawConn, p, appID, instanceID st
|
||||
|
||||
// keep socket alive until done is requested
|
||||
<-done
|
||||
runtime.KeepAlive(syncPipe[1].Fd())
|
||||
}); err != nil {
|
||||
setupDone <- err
|
||||
}
|
||||
|
||||
@@ -23,7 +23,7 @@ static const struct wl_registry_listener registry_listener = {
|
||||
.global_remove = registry_handle_global_remove,
|
||||
};
|
||||
|
||||
int32_t bind_wayland_fd(char *socket_path, int fd, const char *app_id, const char *instance_id, int sync_fd) {
|
||||
int32_t f_bind_wayland_fd(char *socket_path, int fd, const char *app_id, const char *instance_id, int sync_fd) {
|
||||
int32_t res = 0; // refer to resErr for meaning
|
||||
|
||||
struct wl_display *display;
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
#include <stdint.h>
|
||||
|
||||
int32_t bind_wayland_fd(char *socket_path, int fd, const char *app_id, const char *instance_id, int sync_fd);
|
||||
int32_t f_bind_wayland_fd(char *socket_path, int fd, const char *app_id, const char *instance_id, int sync_fd);
|
||||
2
wl/wl.go
2
wl/wl.go
@@ -29,7 +29,7 @@ func bindWaylandFd(socketPath string, fd uintptr, appID, instanceID string, sync
|
||||
if hasNull(appID) || hasNull(instanceID) {
|
||||
return ErrContainsNull
|
||||
}
|
||||
res := C.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)]
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user