# HG changeset patch # User sla # Date 1332184397 -3600 # Node ID e2a2328a872b618ad591dff201e59a9c500caa85 # Parent 09313032e63bf23ad8970d3d6cd8e8521cb26934 7152800: All tests using the attach API fail with "well-known file is not secure" on Mac OS X Summary: Create well-known file with effective group of the current process Reviewed-by: kamg, dcubed diff -r 09313032e63b -r e2a2328a872b hotspot/src/os/bsd/vm/attachListener_bsd.cpp --- a/hotspot/src/os/bsd/vm/attachListener_bsd.cpp Sat Mar 17 00:27:39 2012 -0700 +++ b/hotspot/src/os/bsd/vm/attachListener_bsd.cpp Mon Mar 19 20:13:17 2012 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2012, 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 @@ -206,10 +206,15 @@ // put in listen mode, set permissions, and rename into place res = ::listen(listener, 5); if (res == 0) { - RESTARTABLE(::chmod(initial_path, S_IREAD|S_IWRITE), res); + RESTARTABLE(::chmod(initial_path, S_IREAD|S_IWRITE), res); + if (res == 0) { + // make sure the file is owned by the effective user and effective group + // (this is the default on linux, but not on mac os) + RESTARTABLE(::chown(initial_path, geteuid(), getegid()), res); if (res == 0) { - res = ::rename(initial_path, path); + res = ::rename(initial_path, path); } + } } if (res == -1) { RESTARTABLE(::close(listener), res);