[*] 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

@ -270,7 +270,6 @@ namespace Aurora::IO::FS
// Do not entertain an arbitrarily large page length provided by non-regular fds // Do not entertain an arbitrarily large page length provided by non-regular fds
buffer.writePtr += uLength; buffer.writePtr += uLength;
if (bIsZero) if (bIsZero)
{ {
AuTryDownsize(buffer, uLength); AuTryDownsize(buffer, uLength);

View File

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