Skip to content

Commit

Permalink
Backport 16dba04e8dfa871f8056480a42a9baeb24a2fb24
Browse files Browse the repository at this point in the history
  • Loading branch information
duke committed Aug 29, 2024
1 parent 6f382d1 commit 9dd7c71
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions src/java.base/unix/native/libjava/ProcessImpl_md.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 1995, 2023, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1995, 2024, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
Expand Down Expand Up @@ -562,8 +562,17 @@ spawnChild(JNIEnv *env, jobject process, ChildStuff *c, const char *helperpath)
}
offset = copystrings(buf, 0, &c->argv[0]);
offset = copystrings(buf, offset, &c->envv[0]);
memcpy(buf+offset, c->pdir, sp.dirlen);
offset += sp.dirlen;
if (c->pdir != NULL) {
if (sp.dirlen > 0) {
memcpy(buf+offset, c->pdir, sp.dirlen);
offset += sp.dirlen;
}
} else {
if (sp.dirlen > 0) {
free(buf);
return -1;
}
}
offset = copystrings(buf, offset, parentPathv);
assert(offset == bufsize);

Expand Down

0 comments on commit 9dd7c71

Please sign in to comment.