# HG changeset patch # User sla # Date 1332184397 -3600 # Node ID 77591ef8983a98ca476db357976fbdd0fefccb7e # Parent a142c661f6b17bea7683ded1d60d78c35202a475 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 a142c661f6b1 -r 77591ef8983a src/os/bsd/vm/attachListener_bsd.cpp --- a/src/os/bsd/vm/attachListener_bsd.cpp Sat Mar 17 00:27:39 2012 -0700 +++ b/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);