mirror of
https://github.com/RGBCube/serenity
synced 2025-05-30 18:28:10 +00:00
SystemServer+LibCore: Move /tmp/rpc/ directory creation to SystemServer
This doesn't solve half of the problems with /tmp/rpc, but this way we can at least make it sticky instead of having it fully world-writable and owned by whoever was the first to bind an RPC socket.
This commit is contained in:
parent
795bccbf69
commit
d38b9916c9
2 changed files with 15 additions and 16 deletions
|
@ -314,22 +314,8 @@ EventLoop::~EventLoop()
|
|||
|
||||
bool EventLoop::start_rpc_server()
|
||||
{
|
||||
// Create /tmp/rpc if it doesn't exist.
|
||||
int rc = mkdir("/tmp/rpc", 0777);
|
||||
if (rc == 0) {
|
||||
// Ensure it gets created as 0777 despite our umask.
|
||||
rc = chmod("/tmp/rpc", 0777);
|
||||
if (rc < 0) {
|
||||
perror("chmod /tmp/rpc");
|
||||
// Continue further.
|
||||
}
|
||||
} else if (errno != EEXIST) {
|
||||
perror("mkdir /tmp/rpc");
|
||||
return false;
|
||||
}
|
||||
|
||||
auto rpc_path = String::format("/tmp/rpc/%d", getpid());
|
||||
rc = unlink(rpc_path.characters());
|
||||
auto rpc_path = String::formatted("/tmp/rpc/{}", getpid());
|
||||
auto rc = unlink(rpc_path.characters());
|
||||
if (rc < 0 && errno != ENOENT) {
|
||||
perror("unlink");
|
||||
return false;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue