[utils] Simplify setproctitle
This commit is contained in:
		| @@ -1126,11 +1126,11 @@ def setproctitle(title): | |||||||
|         libc = ctypes.cdll.LoadLibrary("libc.so.6") |         libc = ctypes.cdll.LoadLibrary("libc.so.6") | ||||||
|     except OSError: |     except OSError: | ||||||
|         return |         return | ||||||
|     title = title |     title_bytes = title.encode('utf-8') | ||||||
|     buf = ctypes.create_string_buffer(len(title) + 1) |     buf = ctypes.create_string_buffer(len(title_bytes)) | ||||||
|     buf.value = title.encode('utf-8') |     buf.value = title_bytes | ||||||
|     try: |     try: | ||||||
|         libc.prctl(15, ctypes.byref(buf), 0, 0, 0) |         libc.prctl(15, buf, 0, 0, 0) | ||||||
|     except AttributeError: |     except AttributeError: | ||||||
|         return  # Strange libc, just skip this |         return  # Strange libc, just skip this | ||||||
|  |  | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Philipp Hagemeister
					Philipp Hagemeister