8194734: Handle to jimage file inherited into child processes (win)
Reviewed-by: alanb
Contributed-by: alexandr.miloslavskiy@gmail.com
--- a/src/java.base/windows/native/libjimage/osSupport_windows.cpp Sat Apr 14 08:41:42 2018 +0100
+++ b/src/java.base/windows/native/libjimage/osSupport_windows.cpp Mon Apr 16 09:36:01 2018 +0100
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -38,7 +38,8 @@
* Return the file descriptor.
*/
jint osSupport::openReadOnly(const char *path) {
- return ::open(path, 0, 0);
+ // jimage file descriptors must not be inherited by child processes
+ return ::open(path, O_BINARY | O_NOINHERIT, O_RDONLY);
}
/**