From 48ba511bda6a4c8344897b7263b9ffdc99bf4e36 Mon Sep 17 00:00:00 2001 From: jpark37 Date: Sat, 30 Jan 2021 00:13:03 -0800 Subject: [PATCH] UI: Avoid asprintf warning --- UI/platform-x11.cpp | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/UI/platform-x11.cpp b/UI/platform-x11.cpp index cb2717230..b41f1c3c9 100644 --- a/UI/platform-x11.cpp +++ b/UI/platform-x11.cpp @@ -65,12 +65,9 @@ void RunningInstanceCheck(bool &already_running) struct sockaddr_un bindInfo; memset(&bindInfo, 0, sizeof(sockaddr_un)); bindInfo.sun_family = AF_LOCAL; - char *abstactSockName = NULL; - asprintf(&abstactSockName, "%s %d %s", "/com/obsproject", getpid(), + snprintf(bindInfo.sun_path + 1, sizeof(bindInfo.sun_path) - 1, + "%s %d %s", "/com/obsproject", getpid(), App()->GetVersionString().c_str()); - memmove(bindInfo.sun_path + 1, abstactSockName, - strlen(abstactSockName)); - free(abstactSockName); int bindErr = bind(uniq, (struct sockaddr *)&bindInfo, sizeof(struct sockaddr_un));