diff options
| author | Paul Buetow <paul@buetow.org> | 2025-03-14 22:58:10 +0200 |
|---|---|---|
| committer | Paul Buetow <paul@buetow.org> | 2025-03-14 22:58:10 +0200 |
| commit | 3edde70ef17d23a3f2fcb0fac11a50e8810ab943 (patch) | |
| tree | 677a865082872147ebf75426f2192d1ac2ff2f6a /internal/eventloop.go | |
| parent | 1827045051c46db54662e1b4b710504da438f1d1 (diff) | |
fixed a bug with the filepath
Diffstat (limited to 'internal/eventloop.go')
| -rw-r--r-- | internal/eventloop.go | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/internal/eventloop.go b/internal/eventloop.go index fca5958..1e7fea6 100644 --- a/internal/eventloop.go +++ b/internal/eventloop.go @@ -3,6 +3,7 @@ package internal import "C" import ( + "bytes" "context" "fmt" "os" @@ -178,7 +179,11 @@ func (e *eventLoop) syscallExit(exitEv event.Event, ch chan<- *event.Pair) { openEv := ev.EnterEv.(*OpenEvent) fd := int32(ev.ExitEv.(*RetEvent).Ret) - file := file.NewFd(fd, string(openEv.Filename[:])) + // It's from an array, so only create string from array until first 0 byte + // TODO: This could speed up the path filter as well + // TODO: Hopefully, this won't cause a panic when the filename is as long as the array itself + filePath := string(openEv.Filename[:bytes.IndexByte(openEv.Filename[:], 0)]) + file := file.NewFd(fd, filePath) if fd >= 0 { e.files[fd] = file } |
