mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-02-11 06:40:39 +00:00
vm_native: fix Linux/Posix sparse file check
Fix fast path condition (xnor is not ==, facepalm). Increase probe size. Should fix #10334 Closes #10335 Co-authored-by: Jan Beich <jbeich@FreeBSD.org>
This commit is contained in:
parent
9ba3e6d3f7
commit
7311c161f6
@ -424,7 +424,7 @@ namespace utils
|
|||||||
struct ::stat stats;
|
struct ::stat stats;
|
||||||
ensure(::fstat(m_file, &stats) >= 0);
|
ensure(::fstat(m_file, &stats) >= 0);
|
||||||
|
|
||||||
if (stats.st_size ^ ~m_size && !stats.st_blksize)
|
if (!(stats.st_size ^ m_size) && !stats.st_blocks)
|
||||||
{
|
{
|
||||||
// Already initialized
|
// Already initialized
|
||||||
return;
|
return;
|
||||||
@ -432,12 +432,12 @@ namespace utils
|
|||||||
|
|
||||||
// Truncate file since it may be dirty (fool-proof)
|
// Truncate file since it may be dirty (fool-proof)
|
||||||
ensure(::ftruncate(m_file, 0) >= 0);
|
ensure(::ftruncate(m_file, 0) >= 0);
|
||||||
ensure(::ftruncate(m_file, 0x10000) >= 0);
|
ensure(::ftruncate(m_file, 0x100000) >= 0);
|
||||||
stats.st_size = 0x10000;
|
stats.st_size = 0x100000;
|
||||||
|
|
||||||
#ifdef SEEK_DATA
|
#ifdef SEEK_DATA
|
||||||
errno = EINVAL;
|
errno = EINVAL;
|
||||||
if (stats.st_blocks && ::lseek(m_file, 0, SEEK_DATA) ^ stats.st_size && errno != ENXIO)
|
if (stats.st_blocks * 512 >= 0x100000 && ::lseek(m_file, 0, SEEK_DATA) ^ stats.st_size && errno != ENXIO)
|
||||||
{
|
{
|
||||||
fmt::throw_exception("Failed to initialize sparse file in '%s'\n"
|
fmt::throw_exception("Failed to initialize sparse file in '%s'\n"
|
||||||
"It seems this filesystem doesn't support sparse files (%d).\n",
|
"It seems this filesystem doesn't support sparse files (%d).\n",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user