[Bf-blender-cvs] [8b78510fc47] master: GHOST/wayland: handle return values for data sources

Christian Rauch noreply at git.blender.org
Thu Jun 3 19:24:16 CEST 2021


Commit: 8b78510fc47a6c89036d371dfb8693cb851c61ab
Author: Christian Rauch
Date:   Mon May 24 00:51:00 2021 +0100
Branches: master
https://developer.blender.org/rB8b78510fc47a6c89036d371dfb8693cb851c61ab

GHOST/wayland: handle return values for data sources

===================================================================

M	intern/ghost/intern/GHOST_SystemWayland.cpp

===================================================================

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<char *>(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);
 }



More information about the Bf-blender-cvs mailing list