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
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C

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)