commit d25622dbc4b345f6d93c5e37ccb06a35b02373d8
parent f180fef42c0bf8ffbbd8caa5416436abb6c68500
Author: Pinghao Wu <xdavidwuph@gmail.com>
Date: Mon, 27 Jun 2022 23:55:55 +0800
linux::timerfd: read: report read errors
Read errors like EINTR may happen here.
Signed-off-by: Pinghao Wu <xdavidwuph@gmail.com>
Diffstat:
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/linux/timerfd/timerfd.ha b/linux/timerfd/timerfd.ha
@@ -97,7 +97,12 @@ export fn read(
t: io::file
) (u64 | errors::error) = {
let expirations: [8]u8 = [0...];
- io::read(t, expirations)!;
+ match (rt::read(t, &expirations, len(expirations))) {
+ case let err: rt::errno =>
+ return errors::errno(err);
+ case let z: size =>
+ assert(z == len(expirations));
+ };
return endian::host.getu64(expirations);
};