diff options
| author | Paul Buetow <paul@buetow.org> | 2025-03-22 23:35:42 +0200 |
|---|---|---|
| committer | Paul Buetow <paul@buetow.org> | 2025-03-22 23:35:42 +0200 |
| commit | acb810dac5ae8aed48ddd4a865c7fbeca52c4e0d (patch) | |
| tree | 5fff337728e9869c41854b59eddbacb208cf5c3a | |
| parent | 5fa2439de2cedfaef6aca125769facd4bc3bc9b5 (diff) | |
fix nil pointer deref
| -rw-r--r-- | internal/eventloop.go | 10 |
1 files changed, 4 insertions, 6 deletions
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: |
