7059259: (process) ProcessBuilder.start permission check should be improved when redirecting output to append

Reviewed-by: hawtin
This commit is contained in:
Alan Bateman 2011-06-27 20:30:40 +01:00
parent a2a420e7de
commit c3c22d1d74

View File

@ -60,10 +60,11 @@ final class ProcessImpl extends Process {
throws IOException
{
if (append) {
String path = f.getPath();
SecurityManager sm = System.getSecurityManager();
if (sm != null)
sm.checkWrite(f.getPath());
long handle = openForAtomicAppend(f.getPath());
sm.checkWrite(path);
long handle = openForAtomicAppend(path);
final FileDescriptor fd = new FileDescriptor();
fdAccess.setHandle(fd, handle);
return AccessController.doPrivileged(