Use uid rather than user name which can be arbitrary length in socket path

This commit is contained in:
Kovid Goyal
2025-03-28 11:40:00 +05:30
parent 50d71bda18
commit e316b304d6
+1 -1
View File
@@ -45,7 +45,7 @@ def socket_address(which):
ans = '\0' + sock_name
else:
# tempdir already contains calibre in its path
sock_name = '{}-{}.sock'.format(ascii_filename(user).replace(' ', '_'), which)
sock_name = f'{os.getuid()}-{which}.sock'
from tempfile import gettempdir
tmp = force_unicode(gettempdir(), filesystem_encoding)
ans = os.path.join(tmp, sock_name)