Remove st_blocks hack from wxFile::Length() under Linux
This reverts commit 41f6f17d01
("return 0
(meaning the file is not seekable, as the docs now explain) instead of
4KB for the files in sysfs under Linux") as it seems to be wrong to
return a value different from what "ls -l" or "stat" return here and the
original problem was solved in a better way in the previous commit.
See #9965.
Closes #17818.
This commit is contained in:
@@ -144,6 +144,10 @@ void FileTestCase::TempFile()
|
||||
// Check that GetSize() works correctly for special files.
|
||||
TEST_CASE("wxFile::Special", "[file][linux][special-file]")
|
||||
{
|
||||
// We can't test /proc/kcore here, unlike in the similar
|
||||
// wxFileName::GetSize() test, as wxFile must be able to open it (at least
|
||||
// for reading) and usually we don't have the permissions to do it.
|
||||
|
||||
// This file is not seekable and has 0 size, but can still be read.
|
||||
wxFile fileProc("/proc/diskstats");
|
||||
CHECK( fileProc.IsOpened() );
|
||||
@@ -155,6 +159,7 @@ TEST_CASE("wxFile::Special", "[file][linux][special-file]")
|
||||
// All files in /sys seem to have size of 4KiB currently, even if they
|
||||
// don't have that much data in them.
|
||||
wxFile fileSys("/sys/power/state");
|
||||
CHECK( fileSys.Length() == 4096 );
|
||||
CHECK( fileSys.IsOpened() );
|
||||
CHECK( fileSys.ReadAll(&s) );
|
||||
CHECK( !s.empty() );
|
||||
|
Reference in New Issue
Block a user