Skip to content

Commit

Permalink
chore(pkg/driver): cleanup eBPF probe symlink in Cleanup method.
Browse files Browse the repository at this point in the history
Signed-off-by: Federico Di Pierro <[email protected]>
  • Loading branch information
FedeDP committed Dec 11, 2023
1 parent 2b56ef4 commit 287da4e
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions pkg/driver/type/bpf.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,15 +43,17 @@ func (b *bpf) String() string {
return TypeBpf
}

func (b *bpf) Cleanup(_ *output.Printer, _ string) error {
func (b *bpf) Cleanup(printer *output.Printer, driverName string) error {
symlinkPath := filepath.Join(homedir.Get(), ".falco", fmt.Sprintf("%s-bpf.o", driverName))
printer.Logger.Info("Removing eBPF probe symlink", printer.Logger.Args("path", symlinkPath))
_ = os.Remove(symlinkPath)
return nil
}

func (b *bpf) Load(printer *output.Printer, src, driverName string, fallback bool) error {
if !fallback {
symlinkPath := filepath.Join(homedir.Get(), ".falco", fmt.Sprintf("%s-bpf.o", driverName))
printer.Logger.Info("Symlinking eBPF probe", printer.Logger.Args("src", src, "dest", symlinkPath))
_ = os.Remove(symlinkPath)
err := os.Symlink(src, symlinkPath)
if err == nil {
printer.Logger.Info("eBPF probe symlinked")
Expand Down

0 comments on commit 287da4e

Please sign in to comment.