From 8c28f25e1383f10a78b05e47ccf1cc4262069e69 Mon Sep 17 00:00:00 2001 From: Brian Burkhalter Date: Thu, 25 Jul 2024 20:59:48 +0000 Subject: [PATCH] 8337124: (fs) sun.nio.fs.WindowsSecurity.enablePrivilege should pin when continuations supported Reviewed-by: jpai, alanb --- .../windows/classes/sun/nio/fs/WindowsSecurity.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/java.base/windows/classes/sun/nio/fs/WindowsSecurity.java b/src/java.base/windows/classes/sun/nio/fs/WindowsSecurity.java index 19e3e62412b..9bcd800e13c 100644 --- a/src/java.base/windows/classes/sun/nio/fs/WindowsSecurity.java +++ b/src/java.base/windows/classes/sun/nio/fs/WindowsSecurity.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2008, 2024, 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 @@ -25,8 +25,8 @@ package sun.nio.fs; -import jdk.internal.misc.PreviewFeatures; import jdk.internal.vm.Continuation; +import jdk.internal.vm.ContinuationSupport; import static sun.nio.fs.WindowsNativeDispatcher.*; import static sun.nio.fs.WindowsConstants.*; @@ -106,7 +106,7 @@ class WindowsSecurity { final boolean needToRevert = elevated; // prevent yielding with privileges - if (PreviewFeatures.isEnabled()) + if (ContinuationSupport.isSupported()) Continuation.pin(); return () -> { @@ -126,7 +126,7 @@ class WindowsSecurity { } } finally { LocalFree(pLuid); - if (PreviewFeatures.isEnabled()) + if (ContinuationSupport.isSupported()) Continuation.unpin(); } };