From: Elif Aslan Date: Fri, 8 Mar 2024 22:09:18 +0000 (+0000) Subject: [PATCH] 8325567: jspawnhelper without args fails with segfault X-Git-Tag: archive/raspbian/17.0.12+7-2_deb12u1+rpi1^2^2~3 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=f9569f4ea36a5385043e51605df094823c2c3a0a;p=openjdk-17.git [PATCH] 8325567: jspawnhelper without args fails with segfault Origin: commit,262747094670b00ac63463a059074afa9b81d8a4 Bug: https://bugs.openjdk.org/browse/JDK-8325567 Co-authored-by: Vladimir Petko Reviewed-by: eastigeevich, rriggs, shade, vpetko Reviewed-by: eastigeevich, rriggs, shade, vpetko Gbp-Pq: Name jdk-8325567.patch --- diff --git a/src/java.base/unix/native/jspawnhelper/jspawnhelper.c b/src/java.base/unix/native/jspawnhelper/jspawnhelper.c index 7f86826f0..cb660b320 100644 --- a/src/java.base/unix/native/jspawnhelper/jspawnhelper.c +++ b/src/java.base/unix/native/jspawnhelper/jspawnhelper.c @@ -62,6 +62,7 @@ void shutItDown() { fprintf(stdout, "only be run as the result of a call to\n"); fprintf(stdout, "ProcessBuilder.start() or Runtime.exec() in a java "); fprintf(stdout, "application\n"); + fflush(stdout); _exit(1); } @@ -142,6 +143,10 @@ int main(int argc, char *argv[]) { /* argv[1] contains the fd number to read all the child info */ int r, fdinr, fdinw, fdout; + if (argc != 2) { + shutItDown(); + } + #ifdef DEBUG jtregSimulateCrash(0, 4); #endif