提交 87c409d3 编写于 作者: S sla

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
上级 64e9360d
/*
* 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 @@ int BsdAttachListener::init() {
// 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);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册