summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorExplorer09 <explorer09@gmail.com>2024-04-19 00:13:34 +0800
committercgzones <cgzones@googlemail.com>2024-04-26 19:35:15 +0200
commite54871b6795ac59ee7f98ecfbec50368513d0c6f (patch)
tree2d7531b04da22ebf9d1707a1f895298c9278a7b4
parentc63dc63a71a49cde8b2d925808933369d8d89c03 (diff)
Linux: Permit non-ASCII for CGROUP, CONTAINER & SECATTR fields
Assume the CGROUP, CCGROUP, CONTAINER and SECATTR field value may contain non-ASCII characters and use RichString_appendWide() to convert the strings. Patch suggested by Christian Göttsche (@cgzones) Signed-off-by: Kang-Che Sung <explorer09@gmail.com>
-rw-r--r--linux/LinuxProcess.c20
1 files changed, 16 insertions, 4 deletions
diff --git a/linux/LinuxProcess.c b/linux/LinuxProcess.c
index 741fe19d..e70d7d0c 100644
--- a/linux/LinuxProcess.c
+++ b/linux/LinuxProcess.c
@@ -284,9 +284,18 @@ static void LinuxProcess_rowWriteField(const Row* super, RichString* str, Proces
#ifdef HAVE_VSERVER
case VXID: xSnprintf(buffer, n, "%5u ", lp->vxid); break;
#endif
- case CGROUP: xSnprintf(buffer, n, "%-*.*s ", Row_fieldWidths[CGROUP], Row_fieldWidths[CGROUP], lp->cgroup ? lp->cgroup : "N/A"); break;
- case CCGROUP: xSnprintf(buffer, n, "%-*.*s ", Row_fieldWidths[CCGROUP], Row_fieldWidths[CCGROUP], lp->cgroup_short ? lp->cgroup_short : (lp->cgroup ? lp->cgroup : "N/A")); break;
- case CONTAINER: xSnprintf(buffer, n, "%-*.*s ", Row_fieldWidths[CONTAINER], Row_fieldWidths[CONTAINER], lp->container_short ? lp->container_short : "N/A"); break;
+ case CGROUP:
+ xSnprintf(buffer, n, "%-*.*s ", Row_fieldWidths[CGROUP], Row_fieldWidths[CGROUP], lp->cgroup ? lp->cgroup : "N/A");
+ RichString_appendWide(str, attr, buffer);
+ return;
+ case CCGROUP:
+ xSnprintf(buffer, n, "%-*.*s ", Row_fieldWidths[CCGROUP], Row_fieldWidths[CCGROUP], lp->cgroup_short ? lp->cgroup_short : (lp->cgroup ? lp->cgroup : "N/A"));
+ RichString_appendWide(str, attr, buffer);
+ return;
+ case CONTAINER:
+ xSnprintf(buffer, n, "%-*.*s ", Row_fieldWidths[CONTAINER], Row_fieldWidths[CONTAINER], lp->container_short ? lp->container_short : "N/A");
+ RichString_appendWide(str, attr, buffer);
+ return;
case OOM: xSnprintf(buffer, n, "%4u ", lp->oom); break;
case IO_PRIORITY: {
int klass = IOPriority_class(lp->ioPriority);
@@ -317,7 +326,10 @@ static void LinuxProcess_rowWriteField(const Row* super, RichString* str, Proces
}
xSnprintf(buffer, n, "%5lu ", lp->ctxt_diff);
break;
- case SECATTR: snprintf(buffer, n, "%-*.*s ", Row_fieldWidths[SECATTR], Row_fieldWidths[SECATTR], lp->secattr ? lp->secattr : "N/A"); break;
+ case SECATTR:
+ snprintf(buffer, n, "%-*.*s ", Row_fieldWidths[SECATTR], Row_fieldWidths[SECATTR], lp->secattr ? lp->secattr : "N/A");
+ RichString_appendWide(str, attr, buffer);
+ return;
case AUTOGROUP_ID:
if (lp->autogroup_id != -1) {
xSnprintf(buffer, n, "%4ld ", lp->autogroup_id);

© 2014-2024 Faster IT GmbH | imprint | privacy policy