From 75c89fcccd7d52e50464cc893c9c9f07ca666fb6 Mon Sep 17 00:00:00 2001 From: chaoli Date: Tue, 13 Feb 2024 14:05:46 +0000 Subject: [PATCH] pass hotspot attach --- pkg/cgo/jattach.c | 8 ++++---- pkg/cgo/jattach_test.c | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/pkg/cgo/jattach.c b/pkg/cgo/jattach.c index 07c0254..9891ae5 100644 --- a/pkg/cgo/jattach.c +++ b/pkg/cgo/jattach.c @@ -258,10 +258,10 @@ static int write_command(int fd, char * command, char* arguments) { char* p = stpncpy(buf, "1", sizeof(buf)) + 1; p = stpncpy(p, command, limit - p) + 1; - char * space=" "; - p = stpncpy(p, space, limit - p) + 1; - p = stpncpy(p, arguments, limit - p) + 1; - for (;p < limit; ) { + //char* space=" "; + //p = stpncpy(p, space, limit - p) + 1; + //p = stpncpy(p, arguments, limit - p) + 1; + for (int i=1;i<4 && p < limit;i++ ) { *p++ = 0; } diff --git a/pkg/cgo/jattach_test.c b/pkg/cgo/jattach_test.c index dae9f29..f098e43 100644 --- a/pkg/cgo/jattach_test.c +++ b/pkg/cgo/jattach_test.c @@ -1,6 +1,6 @@ #include "jattach.c" int main(int argc,char ** argv){ - jattach(18826,"1","2",0); + jattach(78596,"threaddump","",1); return 0; } \ No newline at end of file