From acb810dac5ae8aed48ddd4a865c7fbeca52c4e0d Mon Sep 17 00:00:00 2001 From: Paul Buetow Date: Sat, 22 Mar 2025 23:35:42 +0200 Subject: fix nil pointer deref --- internal/eventloop.go | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) (limited to 'internal') diff --git a/internal/eventloop.go b/internal/eventloop.go index b451b69..102a500 100644 --- a/internal/eventloop.go +++ b/internal/eventloop.go @@ -238,29 +238,27 @@ func (e *eventLoop) syscallExit(exitEv event.Event, ch chan<- *event.Pair) { } case *FcntlEvent: ev.Comm = e.comm(ev.EnterEv.GetTid()) - if !e.filter.eventPair(ev) { - ev.Recycle() - return - } fd := int32(v.Fd) if file_, ok := e.files[fd]; ok { ev.File = file_ } else { ev.File = file.NewFdWithPid(fd, v.Pid) } + if !e.filter.eventPair(ev) { + ev.Recycle() + return + } switch v.Cmd { case syscall.F_SETFL: fdFile, ok := ev.File.(file.FdFile) if !ok { panic("expected a file.FdFile") } - fmt.Println("DEBUG BEFORE", fdFile.FlagsString()) // fcntl(2) canChange := syscall.O_APPEND | syscall.O_ASYNC | syscall.O_DIRECT | syscall.O_NOATIME | syscall.O_NONBLOCK fdFile.Flags |= (int32(v.Arg) & int32(canChange)) ev.File = fdFile e.files[fd] = fdFile - fmt.Println("DEBUG AFTER", fdFile.FlagsString()) case syscall.F_DUPFD: fmt.Println("TODO: F_DUPFD with fcntl not yet implememented") case syscall.F_DUPFD_CLOEXEC: -- cgit v1.2.3