diff options
author | Christian Rauch <Rauch.Christian@gmx.de> | 2021-05-24 02:51:00 +0300 |
---|---|---|
committer | Christian Rauch <Rauch.Christian@gmx.de> | 2021-06-03 20:18:27 +0300 |
commit | 8b78510fc47a6c89036d371dfb8693cb851c61ab (patch) | |
tree | d1e46f9ede604f86e8eacbfa12d6be37dc1a311e /intern | |
parent | e0bc5c4087f961db7504959c4eb09c04bda0ff5c (diff) |
GHOST/wayland: handle return values for data sources
Diffstat (limited to 'intern')
-rw-r--r-- | intern/ghost/intern/GHOST_SystemWayland.cpp | 8 |
1 files 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<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); } |