From 8b78510fc47a6c89036d371dfb8693cb851c61ab Mon Sep 17 00:00:00 2001 From: Christian Rauch Date: Mon, 24 May 2021 00:51:00 +0100 Subject: GHOST/wayland: handle return values for data sources --- intern/ghost/intern/GHOST_SystemWayland.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/intern/ghost/intern/GHOST_SystemWayland.cpp b/intern/ghost/intern/GHOST_SystemWayland.cpp index f1d867da884..d6e46f27918 100644 --- a/intern/ghost/intern/GHOST_SystemWayland.cpp +++ b/intern/ghost/intern/GHOST_SystemWayland.cpp @@ -479,7 +479,9 @@ static void dnd_events(const input_t *const input, const GHOST_TEventType event) static std::string read_pipe(data_offer_t *data_offer, const std::string mime_receive) { int pipefd[2]; - pipe(pipefd); + if (pipe(pipefd) != 0) { + return {}; + } wl_data_offer_receive(data_offer->id, mime_receive.c_str(), pipefd[1]); close(pipefd[1]); @@ -514,7 +516,9 @@ static void data_source_send(void *data, int32_t fd) { const char *const buffer = static_cast(data); - write(fd, buffer, strlen(buffer) + 1); + if (write(fd, buffer, strlen(buffer) + 1) < 0) { + GHOST_PRINT("error writing to clipboard: " << std::strerror(errno) << std::endl); + } close(fd); } -- cgit v1.2.3