Sway IPC: fix socket path discovery

Ensure to only read actual "sway --get-socketpath" output, not
subsequent garbage in buffer.
This commit is contained in:
Carlo Teubner
2026-05-24 06:41:51 +01:00
parent 05945748dc
commit 89b5456cd3
+1 -1
View File
@@ -45,7 +45,7 @@ const std::string Ipc::getSocketPath() const {
throw std::runtime_error("Failed to get socket path"); throw std::runtime_error("Failed to get socket path");
} }
while (fgets(buf, sizeof(buf), in) != nullptr) { while (fgets(buf, sizeof(buf), in) != nullptr) {
str_buf.append(buf, sizeof(buf)); str_buf.append(buf);
} }
pclose(in); pclose(in);
str = str_buf; str = str_buf;