summary refs log tree commit diff
diff options
context:
space:
mode:
authorPhilipp Hagemeister <phihag@phihag.de>2014-03-23 14:28:22 +0100
committerPhilipp Hagemeister <phihag@phihag.de>2014-03-23 14:28:22 +0100
commit6eefe53329ad22a2b2c7be123b8a9b758a6ea205 (patch)
tree5010a96b6e847ecbb867e6e8ae864717156fc8f3
parent1986025d2b90abbbb2b71a489ec67b5759e1dfab (diff)
downloadyoutube-dl-6eefe53329ad22a2b2c7be123b8a9b758a6ea205.tar.gz
youtube-dl-6eefe53329ad22a2b2c7be123b8a9b758a6ea205.tar.xz
youtube-dl-6eefe53329ad22a2b2c7be123b8a9b758a6ea205.zip
[utils] Simplify setproctitle
-rw-r--r--youtube_dl/utils.py8
1 files changed, 4 insertions, 4 deletions
diff --git a/youtube_dl/utils.py b/youtube_dl/utils.py
index 3574fc615..8b359cb77 100644
--- a/youtube_dl/utils.py
+++ b/youtube_dl/utils.py
@@ -1126,11 +1126,11 @@ def setproctitle(title):
         libc = ctypes.cdll.LoadLibrary("libc.so.6")
     except OSError:
         return
-    title = title
-    buf = ctypes.create_string_buffer(len(title) + 1)
-    buf.value = title.encode('utf-8')
+    title_bytes = title.encode('utf-8')
+    buf = ctypes.create_string_buffer(len(title_bytes))
+    buf.value = title_bytes
     try:
-        libc.prctl(15, ctypes.byref(buf), 0, 0, 0)
+        libc.prctl(15, buf, 0, 0, 0)
     except AttributeError:
         return  # Strange libc, just skip this