summaryrefslogtreecommitdiff
path: root/Services
diff options
context:
space:
mode:
authorAndreas Kling <kling@serenityos.org>2021-01-10 10:32:54 +0100
committerAndreas Kling <kling@serenityos.org>2021-01-10 10:34:45 +0100
commitd38b9916c99543a40d0c297ac92815f2ad1a7508 (patch)
tree8dd85af4fe99b2930207902df0a6aea65dbcbe9f /Services
parent795bccbf697a805eaece48e1c554fc5fe1ab09fc (diff)
downloadserenity-d38b9916c99543a40d0c297ac92815f2ad1a7508.zip
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.
Diffstat (limited to 'Services')
-rw-r--r--Services/SystemServer/main.cpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/Services/SystemServer/main.cpp b/Services/SystemServer/main.cpp
index 56179e86b5..19cf7b2895 100644
--- a/Services/SystemServer/main.cpp
+++ b/Services/SystemServer/main.cpp
@@ -180,6 +180,18 @@ static void mount_all_filesystems()
}
}
+static void create_tmp_rpc_directory()
+{
+ dbgln("Creating /tmp/rpc directory");
+ auto old_umask = umask(0);
+ auto rc = mkdir("/tmp/rpc", 01777);
+ if (rc < 0) {
+ perror("mkdir(/tmp/rpc)");
+ ASSERT_NOT_REACHED();
+ }
+ umask(old_umask);
+}
+
int main(int, char**)
{
prepare_devfs();
@@ -190,6 +202,7 @@ int main(int, char**)
}
mount_all_filesystems();
+ create_tmp_rpc_directory();
parse_boot_mode();
Core::EventLoop event_loop;