--- a/src/jdk.attach/linux/native/libattach/VirtualMachineImpl.c Thu May 31 15:37:18 2018 -0400
+++ b/src/jdk.attach/linux/native/libattach/VirtualMachineImpl.c Thu May 31 14:09:04 2018 -0700
@@ -44,6 +44,8 @@
} while((_result == -1) && (errno == EINTR)); \
} while(0)
+#define ROOT_UID 0
+
/*
* Declare library specific JNI_Onload entry if static build
*/
@@ -156,11 +158,11 @@
if (res == 0) {
char msg[100];
jboolean isError = JNI_FALSE;
- if (sb.st_uid != uid) {
+ if (sb.st_uid != uid && uid != ROOT_UID) {
snprintf(msg, sizeof(msg),
"file should be owned by the current user (which is %d) but is owned by %d", uid, sb.st_uid);
isError = JNI_TRUE;
- } else if (sb.st_gid != gid) {
+ } else if (sb.st_gid != gid && uid != ROOT_UID) {
snprintf(msg, sizeof(msg),
"file's group should be the current group (which is %d) but the group is %d", gid, sb.st_gid);
isError = JNI_TRUE;