Match socket length check with Qt

This commit is contained in:
Ilya Fedin 2022-03-08 12:23:59 +04:00 committed by John Preston
parent cbe7b5f61b
commit 6fd02ccbae

View file

@ -50,6 +50,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include <sys/stat.h> #include <sys/stat.h>
#include <sys/types.h> #include <sys/types.h>
#include <sys/un.h>
#include <cstdlib> #include <cstdlib>
#include <unistd.h> #include <unistd.h>
#include <dirent.h> #include <dirent.h>
@ -384,7 +385,7 @@ QString SingleInstanceLocalServerName(const QString &hash) {
+ '-' + '-'
+ cGUIDStr(); + cGUIDStr();
if (idealSocketPath.size() >= 108) { if ((idealSocketPath.size() + 1) >= sizeof(sockaddr_un().sun_path)) {
return AppRuntimeDirectory() + hash; return AppRuntimeDirectory() + hash;
} else { } else {
return idealSocketPath; return idealSocketPath;