1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-06-01 08:28:11 +00:00

tail: Use File::seek() to determine seekability

Some change in the past made `File::tell()` not return an error if
a file is not seekable. So instead do a real seek to check.
This commit is contained in:
Fabian Dellwing 2024-02-13 19:57:28 +01:00 committed by Jelle Raaijmakers
parent d375b5c2a5
commit 7beabc8e91

View file

@ -62,7 +62,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
if (!follow)
TRY(Core::System::pledge("stdio"));
auto file_is_seekable = !f->tell().is_error();
auto file_is_seekable = !f->seek(0, SeekMode::SetPosition).is_error();
if (!file_is_seekable) {
do {
// FIXME: If f is the standard input, f->read_all() does not block