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:
Vadim Zeitlin
2017-12-15 17:19:09 +01:00
parent cc86de1416
commit a03ece4880
4 changed files with 27 additions and 19 deletions

View File

@@ -95,11 +95,14 @@ public:
/**
Returns the length of the file.
This method may return ::wxInvalidOffset if the length couldn't be
determined or 0 even for non-empty files if the file is not seekable.
Returns ::wxInvalidOffset if the length couldn't be determined.
In general, the only way to determine if the file for which this function
returns 0 is really empty or not is to try reading from it.
Please also note that there is @e no guarantee that reading that many
bytes from the file will always succeed. While this is true for regular
files (unless the file size has been changed by another process in
between Length() and Read() calls), some special files, such as most
files under @c /sys or @c /proc directories under Linux, don't actually
contain as much data as their size indicates.
*/
wxFileOffset Length() const;