From 68156a02ed6495d9735d8eed50708e8d9c168dc8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=A9o=20Lam?= Date: Sat, 22 Oct 2016 19:08:17 +0200 Subject: [PATCH] Fix -Wunused-result warnings --- Source/Core/DolphinWX/Frame.cpp | 17 ++++++++++++----- .../ControllerInterface/evdev/evdev.cpp | 8 ++++++-- 2 files changed, 18 insertions(+), 7 deletions(-) diff --git a/Source/Core/DolphinWX/Frame.cpp b/Source/Core/DolphinWX/Frame.cpp index 5978dfc49d..6c0d62dc6c 100644 --- a/Source/Core/DolphinWX/Frame.cpp +++ b/Source/Core/DolphinWX/Frame.cpp @@ -290,6 +290,17 @@ static BOOL WINAPI s_ctrl_handler(DWORD fdwCtrlType) } #endif +#if defined(__unix__) || defined(__unix) || defined(__APPLE__) +static void SignalHandler(int) +{ + const char message[] = "A signal was received. A second signal will force Dolphin to stop.\n"; + if (write(STDERR_FILENO, message, sizeof(message)) < 0) + { + } + s_shutdown_signal_received.Set(); +} +#endif + CFrame::CFrame(wxFrame* parent, wxWindowID id, const wxString& title, wxRect geometry, bool use_debugger, bool batch_mode, bool show_log_window, long style) : CRenderFrame(parent, id, title, wxDefaultPosition, wxSize(800, 600), style), @@ -445,11 +456,7 @@ CFrame::CFrame(wxFrame* parent, wxWindowID id, const wxString& title, wxRect geo #if defined(__unix__) || defined(__unix) || defined(__APPLE__) struct sigaction sa; - sa.sa_handler = [](int unused) { - char message[] = "A signal was received. A second signal will force Dolphin to stop.\n"; - write(STDERR_FILENO, message, sizeof(message)); - s_shutdown_signal_received.Set(); - }; + sa.sa_handler = SignalHandler; sigemptyset(&sa.sa_mask); sa.sa_flags = SA_RESETHAND; sigaction(SIGINT, &sa, nullptr); diff --git a/Source/Core/InputCommon/ControllerInterface/evdev/evdev.cpp b/Source/Core/InputCommon/ControllerInterface/evdev/evdev.cpp index 08687332fb..d3f8f5fd36 100644 --- a/Source/Core/InputCommon/ControllerInterface/evdev/evdev.cpp +++ b/Source/Core/InputCommon/ControllerInterface/evdev/evdev.cpp @@ -131,7 +131,9 @@ static void StopHotplugThread() { // Write something to efd so that select() stops blocking. uint64_t value = 1; - write(s_wakeup_eventfd, &value, sizeof(uint64_t)); + if (write(s_wakeup_eventfd, &value, sizeof(uint64_t)) < 0) + { + } s_hotplug_thread.join(); } } @@ -404,7 +406,9 @@ void evdevDevice::ForceFeedback::SetState(ControlState state) play.code = m_id; play.value = 1; - write(m_fd, (const void*)&play, sizeof(play)); + if (write(m_fd, &play, sizeof(play)) < 0) + { + } } }