From: Lennart Poettering Date: Sun, 24 Dec 2017 17:50:17 +0000 (+0100) Subject: process-util: debug log if PR_SET_NAME fails. X-Git-Tag: v237~173^2~1 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=5a8af74711acee89cb6c0143587b5c4fdce6d838;p=platform%2Fupstream%2Fsystemd.git process-util: debug log if PR_SET_NAME fails. --- diff --git a/src/basic/process-util.c b/src/basic/process-util.c index 2516730..0537368 100644 --- a/src/basic/process-util.c +++ b/src/basic/process-util.c @@ -304,8 +304,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;