From 7e1765f9f3618d589cc5c15acba928eb2ceb0d90 Mon Sep 17 00:00:00 2001 From: vaxerski <43317083+vaxerski@users.noreply.github.com> Date: Thu, 5 Oct 2023 11:49:44 +0100 Subject: [PATCH] internal: fix usage of execlp in clipboard::copy fixes #42 --- src/clipboard/Clipboard.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/clipboard/Clipboard.cpp b/src/clipboard/Clipboard.cpp index ee018a1..b20908c 100644 --- a/src/clipboard/Clipboard.cpp +++ b/src/clipboard/Clipboard.cpp @@ -3,8 +3,8 @@ #include "../includes.hpp" void Clipboard::copy(const char* fmt, ...) { - char buf[CLIPBOARDMESSAGESIZE] = ""; - char* outputStr; + char buf[CLIPBOARDMESSAGESIZE] = ""; + char* outputStr; va_list args; va_start(args, fmt); @@ -13,7 +13,8 @@ void Clipboard::copy(const char* fmt, ...) { outputStr = strdup(buf); - execlp("wl-copy", "wl-copy", outputStr, NULL); + if (fork() == 0) + execlp("wl-copy", "wl-copy", outputStr, NULL); free(outputStr); } \ No newline at end of file