From 16604997d63dc4039f6426b0afc17baab2fc8a5e Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Wed, 13 Nov 2024 10:43:03 +0100 Subject: [PATCH] system/{Event,Signal}FD: pass std::span to FileDescriptor::Read() --- src/system/EventFD.cxx | 3 ++- src/system/SignalFD.cxx | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/system/EventFD.cxx b/src/system/EventFD.cxx index b3a740165..c567a141e 100644 --- a/src/system/EventFD.cxx +++ b/src/system/EventFD.cxx @@ -3,6 +3,7 @@ #include "EventFD.hxx" #include "system/Error.hxx" +#include "util/SpanCast.hxx" #include @@ -31,5 +32,5 @@ EventFD::Write() noexcept static constexpr eventfd_t value = 1; [[maybe_unused]] ssize_t nbytes = - fd.Write(&value, sizeof(value)); + fd.Write(ReferenceAsBytes(value)); } diff --git a/src/system/SignalFD.cxx b/src/system/SignalFD.cxx index ba3c4d058..72d1da05a 100644 --- a/src/system/SignalFD.cxx +++ b/src/system/SignalFD.cxx @@ -3,6 +3,7 @@ #include "SignalFD.hxx" #include "Error.hxx" +#include "util/SpanCast.hxx" #include @@ -28,7 +29,7 @@ SignalFD::Read() noexcept assert(fd.IsDefined()); signalfd_siginfo info; - return fd.Read(&info, sizeof(info)) > 0 + return fd.Read(ReferenceAsWritableBytes(info)) > 0 ? info.ssi_signo : -1; }