[rpcsx-os] shm: escape subdirectories

This commit is contained in:
DH 2023-11-10 21:30:43 +03:00
parent 1d3a3949f3
commit 74aa1a112e

View file

@ -19,12 +19,16 @@ orbis::ErrorCode ShmDevice::open(orbis::Ref<orbis::File> *file,
ORBIS_LOG_WARNING("shm_open", path, flags, mode);
std::string name = "/rpcsx-";
if (std::string_view{path}.starts_with("/")) {
if (path[0] == '/') {
name += path + 1;
} else {
name += path;
}
for (auto pos = name.find('/', 1); pos != std::string::npos; pos = name.find('/', pos + 1)) {
name[pos] = '$';
}
auto realFlags = O_RDWR; // TODO
std::size_t size = 0;