summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2017-12-24 18:50:17 +0100
committerSven Eden <yamakuzure@gmx.net>2018-05-30 07:49:45 +0200
commit453bb6df25ef3999e6782b6ed846e0c78a1b49a5 (patch)
treef8ca4dd7d79eab2cf7a610a42c53413065098dfb /src
parent30a3ebbb0b6094fca91baa056d1904a564c5d981 (diff)
process-util: debug log if PR_SET_NAME fails.
Diffstat (limited to 'src')
-rw-r--r--src/basic/process-util.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/basic/process-util.c b/src/basic/process-util.c
index 5a00fca83..cb92bab0f 100644
--- a/src/basic/process-util.c
+++ b/src/basic/process-util.c
@@ -305,8 +305,10 @@ int rename_process(const char name[]) {
l = strlen(name);
- /* First step, change the comm field. */
- (void) prctl(PR_SET_NAME, name);
+ /* First step, change the comm field. The main thread's comm is identical to the process comm. This means we
+ * can use PR_SET_NAME, which sets the thread name for the calling thread. */
+ if (prctl(PR_SET_NAME, name) < 0)
+ log_debug_errno(errno, "PR_SET_NAME failed: %m");
if (l > 15) /* Linux process names can be 15 chars at max */
truncated = true;