changeset 49703:d2bea17edd96

8194734: Handle to jimage file inherited into child processes (win) Reviewed-by: alanb Contributed-by: alexandr.miloslavskiy@gmail.com
author alanb
date Mon, 16 Apr 2018 09:36:01 +0100
parents 09c01737ad27
children bc1c7e41e285
files src/java.base/windows/native/libjimage/osSupport_windows.cpp
diffstat 1 files changed, 3 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- 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);
 }
 
 /**