mirror of
https://github.com/RGBCube/serenity
synced 2025-05-14 23:14:59 +00:00
Kernel: Make Inode::set_{a,c,m}time return KResult
This exposed some missing error propagation, which this patch also takes care of.
This commit is contained in:
parent
a5f385f052
commit
cd9be1733c
8 changed files with 42 additions and 44 deletions
|
@ -209,12 +209,10 @@ KResult VFS::utime(StringView path, Custody& base, time_t atime, time_t mtime)
|
|||
if (custody.is_readonly())
|
||||
return EROFS;
|
||||
|
||||
int error = inode.set_atime(atime);
|
||||
if (error < 0)
|
||||
return KResult((ErrnoCode)-error);
|
||||
error = inode.set_mtime(mtime);
|
||||
if (error < 0)
|
||||
return KResult((ErrnoCode)-error);
|
||||
if (auto result = inode.set_atime(atime); result.is_error())
|
||||
return result;
|
||||
if (auto result = inode.set_mtime(mtime); result.is_error())
|
||||
return result;
|
||||
return KSuccess;
|
||||
}
|
||||
|
||||
|
@ -319,10 +317,10 @@ KResultOr<NonnullRefPtr<FileDescription>> VFS::open(StringView path, int options
|
|||
return EROFS;
|
||||
|
||||
if (should_truncate_file) {
|
||||
KResult result = inode.truncate(0);
|
||||
if (result.is_error())
|
||||
if (auto result = inode.truncate(0); result.is_error())
|
||||
return result;
|
||||
if (auto result = inode.set_mtime(kgettimeofday().to_truncated_seconds()); result.is_error())
|
||||
return result;
|
||||
inode.set_mtime(kgettimeofday().to_truncated_seconds());
|
||||
}
|
||||
auto description = FileDescription::create(custody);
|
||||
if (!description.is_error()) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue