Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[23.1] Backport: Minor JNI and libchelper fixes #737

Merged
merged 2 commits into from
May 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
#include <unistd.h>
#include <stdlib.h>
#include <sys/socket.h>
#include <sys/poll.h>
#include <poll.h>
#include <netdb.h>
#include <errno.h>
#include <dlfcn.h>
Expand Down Expand Up @@ -311,10 +311,15 @@ JNIEXPORT jobject JNICALL JVM_DoPrivileged(JNIEnv *env, jclass cls, jobject acti
return (*env)->CallObjectMethod(env, action, run);
}
}

/* Some error occurred - clear pending exception and try to report the error. */
(*env)->ExceptionClear(env);

jclass errorClass = (*env)->FindClass(env, "java/lang/InternalError");
if (errorClass != NULL && !(*env)->ExceptionCheck(env)) {
(*env)->ThrowNew(env, errorClass, "Could not invoke PrivilegedAction");
} else {
(*env)->ExceptionClear(env);
(*env)->FatalError(env, "PrivilegedAction could not be invoked and the error could not be reported");
}
return NULL;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@

#include <sys/syscall.h>
#include <sys/types.h>
#include <unistd.h>

/*
* Based on os::Linux::gettid() from jdk-20-ga, see
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@

#ifdef __linux__

#include <ctype.h>
#include <stdio.h>
#include <string.h>
#include <sys/types.h>
Expand Down
Loading