Skip to content

Commit

Permalink
fix(link)!: Unpin link API
Browse files Browse the repository at this point in the history
The underlying bpf_link__unpin() does not receive a pointer to the
pin path, only for the link itself.
  • Loading branch information
geyslan committed Oct 26, 2023
1 parent 1b882cf commit 3aeb45b
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions link.go
Original file line number Diff line number Diff line change
Expand Up @@ -93,12 +93,10 @@ func (l *BPFLink) Pin(pinPath string) error {
return nil
}

func (l *BPFLink) Unpin(pinPath string) error {
pathC := C.CString(pinPath)
func (l *BPFLink) Unpin() error {
retC := C.bpf_link__unpin(l.link)
C.free(unsafe.Pointer(pathC))
if retC < 0 {
return fmt.Errorf("failed to unpin link %s from path %s: %w", l.eventName, pinPath, syscall.Errno(-retC))
return fmt.Errorf("failed to unpin link %s: %w", l.eventName, syscall.Errno(-retC))
}
return nil
}
Expand Down

0 comments on commit 3aeb45b

Please sign in to comment.