1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-30 21:48:11 +00:00

Kernel: Make KBufferBuilder::append() & friends return KResult

This allows callers to react to a failed append (due to OOM.)
This commit is contained in:
Andreas Kling 2021-09-06 18:24:13 +02:00
parent b096e85777
commit 2065ced8f6
7 changed files with 63 additions and 42 deletions

View file

@ -57,7 +57,7 @@ KResultOr<NonnullOwnPtr<KBuffer>> Inode::read_entire(FileDescription* descriptio
VERIFY(nread <= sizeof(buffer));
if (nread == 0)
break;
builder.append((const char*)buffer, nread);
TRY(builder.append((const char*)buffer, nread));
offset += nread;
if (nread < sizeof(buffer))
break;