1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 01:47:34 +00:00

LibCore: Use ErrorOr<T> for Core::File::size()

This commit is contained in:
Andreas Kling 2021-11-07 01:47:21 +01:00
parent 4a2b718ba2
commit fac2550143
2 changed files with 3 additions and 3 deletions

View file

@ -153,11 +153,11 @@ bool File::exists(String const& filename)
return stat(filename.characters(), &st) == 0;
}
Result<size_t, OSError> File::size(String const& filename)
ErrorOr<size_t> File::size(String const& filename)
{
struct stat st;
if (stat(filename.characters(), &st) < 0)
return OSError(errno);
return Error::from_errno(errno);
return st.st_size;
}