diff options
author | Sven Gothel <[email protected]> | 2013-10-23 16:48:42 +0200 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2013-10-23 16:48:42 +0200 |
commit | fec9712b151ad31b053fe700cb0f809b9715407c (patch) | |
tree | 92201b96715373aa2ac7e13940226864fd65be0d /src/native/common/JarUtil.c | |
parent | 55cc188f0f076a046d05a49c1c82bb90ba545117 (diff) |
Fix Bug 865: Safari >= 6.1 [OSX]: May employ xattr on 'com.apple.quarantine' on 'PluginProcess.app'
- IOUtil.getTempDir(..): Don't test executable caps on OSX for java_io_tmpdir
- JarUtil.extract(..): Issue native fixNativeLibAttribs(..) on OSX for native library files,
i.e. remove xattr 'com.apple.quarantine'
Diffstat (limited to 'src/native/common/JarUtil.c')
-rw-r--r-- | src/native/common/JarUtil.c | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/src/native/common/JarUtil.c b/src/native/common/JarUtil.c new file mode 100644 index 0000000..c918f77 --- /dev/null +++ b/src/native/common/JarUtil.c @@ -0,0 +1,39 @@ +#include <jni.h> + +#include <assert.h> + +#include "com_jogamp_common_util_JarUtil.h" + +#if defined(__APPLE__) + #include <sys/xattr.h> + static const char kQuarantineAttrName[] = "com.apple.quarantine"; +#endif + +/* + * Class: com_jogamp_common_util_JarUtil + * Method: fixNativeLibAttribs + * Signature: (Ljava/lang/String;)Z + */ +JNIEXPORT jboolean JNICALL Java_com_jogamp_common_util_JarUtil_fixNativeLibAttribs + (JNIEnv *env, jclass _unused, jstring fname) { + const char* _UTF8fname = NULL; + int status = 0; + if (fname != NULL) { + if (fname != NULL) { + _UTF8fname = (*env)->GetStringUTFChars(env, fname, (jboolean*)NULL); + if (_UTF8fname == NULL) { + (*env)->ThrowNew(env, (*env)->FindClass(env, "java/lang/OutOfMemoryError"), + "Failed to get UTF-8 chars for argument \"fname\" in native dispatcher for \"removexattr\""); + return 0; + } + } + } +#if defined(__APPLE__) + status = removexattr(_UTF8fname, kQuarantineAttrName, 0); +#endif + if (fname != NULL) { + (*env)->ReleaseStringUTFChars(env, fname, _UTF8fname); + } + return 0 == status ? JNI_TRUE : JNI_FALSE; +} + |