[*] Resolve IO regressions (4. Hello FS) (Mostly UNIX)

This commit is contained in:
Reece Wilson 2023-09-18 07:11:34 +01:00
parent 11ef18cbf0
commit 5d12f1a203
2 changed files with 6 additions and 8 deletions

View File

@ -265,12 +265,11 @@ namespace Aurora::IO::FS
SysPushErrorIO();
return false;
}
// NOTE: File devices love to lie
// Do not entertain an arbitrarily large page length provided by non-regular fds
buffer.writePtr += uLength;
if (bIsZero)
{
AuTryDownsize(buffer, uLength);

View File

@ -38,7 +38,6 @@ namespace Aurora::IO::FS
#else
#error accient 32-bit posix operating systems require 64-bit file awareness
#endif
if (ret < 0)
{
//SysPushErrorIO("PosixLseek63 IO Error: %i", ret);
@ -56,7 +55,7 @@ namespace Aurora::IO::FS
static AuUInt64 PosixGetOffset(int fd)
{
AuUInt64 ret;
if (!PosixLseek63(fd, 0, SEEK_SET, &ret))
if (!PosixLseek63(fd, 0, SEEK_CUR, &ret))
{
return 0;
}
@ -73,14 +72,13 @@ namespace Aurora::IO::FS
AuUInt64 ret {}, old {};
bool status {};
if (!PosixLseek63(fd, 0, SEEK_SET, &old))
if (!PosixLseek63(fd, 0, SEEK_CUR, &old))
{
return 0;
}
status = PosixLseek63(fd, 0, SEEK_END, &ret);
status &= PosixLseek63(fd, old, SEEK_SET, nullptr);
return status ? ret : 0;
}
@ -105,7 +103,7 @@ namespace Aurora::IO::FS
bool PosixWrite(int fd, const void *buf, AuUInt32 count, AuUInt32 *pWritten)
{
auto ret = write(fd, buf, count);
if (ret < 0)
{
SysPushErrorIO("PosixWrite IO Error: %i", ret);
@ -238,6 +236,7 @@ namespace Aurora::IO::FS
AU_LOCK_GUARD(this->spinlock_);
parameters.outVariable = 0;
if (!this->pHandle_)
{
@ -378,7 +377,7 @@ namespace Aurora::IO::FS
return;
}
::ftruncate(fd, GetOffset());
::ftruncate(fd, PosixGetOffset(fd));
}
void PosixFileStream::MakeTemporary()