Skip to content

Commit 8932243

Browse files
authored
java: fix jvm attach cleanup function (#817)
1 parent 22f6313 commit 8932243

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

pkg/internal/transform/route/harvest/harvester.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,8 +85,9 @@ func (h *RouteHarvester) HarvestRoutes(fileInfo *exec.FileInfo) (*RouteHarvester
8585
defer runtime.UnlockOSThread()
8686
myUID, myGID, myPID := jvmAttachInitFunc()
8787
defer func() {
88-
err := jvmAttachCleanupFunc(myUID, myGID, myPID)
89-
h.log.Error("route harvesting cleanup failed", "error", err)
88+
if err := jvmAttachCleanupFunc(myUID, myGID, myPID); err != nil {
89+
h.log.Error("route harvesting cleanup failed", "error", err)
90+
}
9091
}()
9192
}
9293

pkg/internal/transform/route/harvest/java_linux.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,10 @@ func initAttach() (int, int, int) {
2626
}
2727

2828
func cleanupAttach(myUID, myGID, myPID int) error {
29-
if err := syscall.Setegid(myUID); err != nil {
29+
if err := syscall.Seteuid(myUID); err != nil {
3030
return err
3131
}
32-
if err := syscall.Seteuid(myGID); err != nil {
32+
if err := syscall.Setegid(myGID); err != nil {
3333
return err
3434
}
3535

0 commit comments

Comments
 (0)