correctly set process name. Fixes #9034

This commit is contained in:
Yann Leboulanger 2018-04-01 15:05:06 +02:00
parent e326aabf5f
commit 0f13b23a7d
1 changed files with 5 additions and 2 deletions

View File

@ -217,7 +217,7 @@ class GajimApplication(Gtk.Application):
if Gtk.Widget.get_default_direction() == Gtk.TextDirection.RTL:
i18n.direction_mark = '\u200F'
from ctypes import CDLL
from ctypes import CDLL, byref, create_string_buffer
from ctypes.util import find_library
import platform
@ -230,7 +230,10 @@ class GajimApplication(Gtk.Application):
PR_SET_NAME = 15
if sysname == 'Linux':
libc.prctl(PR_SET_NAME, 'gajim')
proc_name = b'gajim'
buff = create_string_buffer(len(proc_name)+1)
buff.value = proc_name
libc.prctl(PR_SET_NAME, byref(buff), 0, 0, 0)
elif sysname in ('FreeBSD', 'OpenBSD', 'NetBSD'):
libc.setproctitle('gajim')