diff --git a/gajim/gajim.py b/gajim/gajim.py
index dc49d1f160f18787677665f7531e46df794514ba..05a520da72e882ee4127a5eb3ebdb61e4d8d9be4 100644
--- a/gajim/gajim.py
+++ b/gajim/gajim.py
@@ -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')