Skip to content

Commit 89a88f0

Browse files
committed
8276651: java/lang/ProcessHandle tests fail with "RuntimeException: Input/output error" in java.lang.ProcessHandleImpl$Info.info0
Backport-of: d24b7b7026cf85f1aecf44f60819762872cfd5c1
1 parent e1b839e commit 89a88f0

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/java.base/macosx/native/libjava/ProcessHandleImpl_macosx.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -272,7 +272,8 @@ void os_getCmdlineAndUserInfo(JNIEnv *env, jobject jinfo, pid_t pid) {
272272
mib[2] = pid;
273273
size = (size_t) maxargs;
274274
if (sysctl(mib, 3, args, &size, NULL, 0) == -1) {
275-
if (errno != EINVAL) {
275+
if (errno != EINVAL && errno != EIO) {
276+
// If the pid is invalid, the information returned is empty and no exception
276277
JNU_ThrowByNameWithLastError(env,
277278
"java/lang/RuntimeException", "sysctl failed");
278279
}
@@ -300,4 +301,3 @@ void os_getCmdlineAndUserInfo(JNIEnv *env, jobject jinfo, pid_t pid) {
300301
// Free the arg buffer
301302
free(args);
302303
}
303-

0 commit comments

Comments
 (0)