mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-07-11 01:08:39 +12:00
sys_fs_fcntl with parameter 0xC0000002 should extract device path from the given path and use that to gather free space information
This commit is contained in:
parent
d6afba96f1
commit
077e710e3a
1 changed files with 15 additions and 3 deletions
|
@ -1,4 +1,4 @@
|
||||||
#include "stdafx.h"
|
#include "stdafx.h"
|
||||||
#include "sys_fs.h"
|
#include "sys_fs.h"
|
||||||
|
|
||||||
#include <mutex>
|
#include <mutex>
|
||||||
|
@ -982,13 +982,25 @@ error_code sys_fs_fcntl(u32 fd, u32 op, vm::ptr<void> _arg, u32 _size)
|
||||||
const auto arg = vm::static_ptr_cast<lv2_file_c0000002>(_arg);
|
const auto arg = vm::static_ptr_cast<lv2_file_c0000002>(_arg);
|
||||||
|
|
||||||
const std::string_view vpath = arg->path.get_ptr();
|
const std::string_view vpath = arg->path.get_ptr();
|
||||||
const std::string local_path = vfs::get(vpath);
|
|
||||||
|
|
||||||
if (vpath.find_first_not_of('/') == -1)
|
if (vpath[0] != '/')
|
||||||
{
|
{
|
||||||
return {CELL_EPERM, vpath};
|
return {CELL_EPERM, vpath};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Extract device from path
|
||||||
|
std::size_t lastslash = vpath.find_first_not_of('/', 1);
|
||||||
|
if (lastslash != std::string_view::npos)
|
||||||
|
{
|
||||||
|
lastslash = vpath.find_first_of('/', lastslash + 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (lastslash == std::string_view::npos) lastslash = vpath.length();
|
||||||
|
else lastslash++;
|
||||||
|
|
||||||
|
const std::string_view device_path = vpath.substr(0, lastslash);
|
||||||
|
const std::string local_path = vfs::get(device_path);
|
||||||
|
|
||||||
if (local_path.empty())
|
if (local_path.empty())
|
||||||
{
|
{
|
||||||
return {CELL_ENOTMOUNTED, vpath};
|
return {CELL_ENOTMOUNTED, vpath};
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue