Skip to content

Commit d24b7b7

Browse files
author
Roger Riggs
committedAug 23, 2022
8276651: java/lang/ProcessHandle tests fail with "RuntimeException: Input/output error" in java.lang.ProcessHandleImpl$Info.info0
Reviewed-by: jpai, alanb
1 parent 8a45abd commit d24b7b7

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

+2-2
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)
Please sign in to comment.