mirror of
https://github.com/rad4day/Waybar.git
synced 2023-12-21 10:22:59 +01:00
fix(2): use getaddrinfo() instead of gethostbyname()
This commit is contained in:
parent
0540977e45
commit
55d7868f86
@ -132,15 +132,20 @@ void IPC::unregisterForIPC(EventHandler* ev_handler) {
|
|||||||
|
|
||||||
std::string IPC::getSocket1Reply(const std::string& rq) {
|
std::string IPC::getSocket1Reply(const std::string& rq) {
|
||||||
// basically hyprctl
|
// basically hyprctl
|
||||||
|
|
||||||
|
struct addrinfo ai_hints;
|
||||||
|
struct addrinfo *ai_res = NULL;
|
||||||
const auto SERVERSOCKET = socket(AF_UNIX, SOCK_STREAM, 0);
|
const auto SERVERSOCKET = socket(AF_UNIX, SOCK_STREAM, 0);
|
||||||
|
|
||||||
if (SERVERSOCKET < 0) {
|
if (SERVERSOCKET < 0) {
|
||||||
spdlog::error("Hyprland IPC: Couldn't open a socket (1)");
|
spdlog::error("Hyprland IPC: Couldn't open a socket (1)");
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
const auto SERVER = getaddrinfo("localhost", NULL, NULL, 0);
|
memset(&ai_hints, 0, sizeof(struct addrinfo));
|
||||||
|
ai_hints.ai_family = AF_UNSPEC;
|
||||||
|
ai_hints.ai_socktype = SOCK_STREAM;
|
||||||
|
const auto SERVER = getaddrinfo("localhost", NULL, &ai_hints, &ai_res);
|
||||||
|
|
||||||
if (!SERVER) {
|
if (!SERVER) {
|
||||||
spdlog::error("Hyprland IPC: Couldn't get host (2)");
|
spdlog::error("Hyprland IPC: Couldn't get host (2)");
|
||||||
|
Loading…
Reference in New Issue
Block a user