summaryrefslogtreecommitdiffstats
path: root/src/basic/process-util.c
diff options
context:
space:
mode:
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2019-05-16 17:44:57 +0200
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2019-05-22 10:16:00 +0200
commite3b4efd28f36a11a15531aa1a56ecadfd6f7253d (patch)
treedb6bee1c192cce630e2ddd393da860851783d78d /src/basic/process-util.c
parentbasic/process-util: convert bool arg to flags (diff)
downloadsystemd-e3b4efd28f36a11a15531aa1a56ecadfd6f7253d.tar.xz
systemd-e3b4efd28f36a11a15531aa1a56ecadfd6f7253d.zip
Add 8bit-version of get_process_cmdline() and use in cgroup-show.c
This restores show_pid_array() output in legacy locales on the console. Only one call to get_process_cmdline() is changed, all others retain utf8-only mode. This affects systemd-cgls, systemctl status, etc, when working locally. Calls to get_process_cmdline() that cross a process boundary always use utf8. It's the callers responsibility to convert this to some encoding that they use. This means that we always pass utf8 over the bus.
Diffstat (limited to 'src/basic/process-util.c')
-rw-r--r--src/basic/process-util.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/basic/process-util.c b/src/basic/process-util.c
index 3e94c9a4aa..b50537908c 100644
--- a/src/basic/process-util.c
+++ b/src/basic/process-util.c
@@ -30,6 +30,7 @@
#include "fileio.h"
#include "fs-util.h"
#include "ioprio.h"
+#include "locale-util.h"
#include "log.h"
#include "macro.h"
#include "memory-util.h"
@@ -178,7 +179,9 @@ int get_process_cmdline(pid_t pid, size_t max_columns, ProcessCmdlineFlags flags
delete_trailing_chars(t, WHITESPACE);
- ans = utf8_escape_non_printable_full(t, max_columns);
+ bool eight_bit = (flags & PROCESS_CMDLINE_USE_LOCALE) && !is_locale_utf8();
+
+ ans = escape_non_printable_full(t, max_columns, eight_bit);
if (!ans)
return -ENOMEM;