Skip to content

Commit e54871b

Browse files
Explorer09cgzones
authored andcommitted
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>
1 parent c63dc63 commit e54871b

File tree

1 file changed

+16
-4
lines changed

1 file changed

+16
-4
lines changed

linux/LinuxProcess.c

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -284,9 +284,18 @@ static void LinuxProcess_rowWriteField(const Row* super, RichString* str, Proces
284284
#ifdef HAVE_VSERVER
285285
case VXID: xSnprintf(buffer, n, "%5u ", lp->vxid); break;
286286
#endif
287-
case CGROUP: xSnprintf(buffer, n, "%-*.*s ", Row_fieldWidths[CGROUP], Row_fieldWidths[CGROUP], lp->cgroup ? lp->cgroup : "N/A"); break;
288-
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;
289-
case CONTAINER: xSnprintf(buffer, n, "%-*.*s ", Row_fieldWidths[CONTAINER], Row_fieldWidths[CONTAINER], lp->container_short ? lp->container_short : "N/A"); break;
287+
case CGROUP:
288+
xSnprintf(buffer, n, "%-*.*s ", Row_fieldWidths[CGROUP], Row_fieldWidths[CGROUP], lp->cgroup ? lp->cgroup : "N/A");
289+
RichString_appendWide(str, attr, buffer);
290+
return;
291+
case CCGROUP:
292+
xSnprintf(buffer, n, "%-*.*s ", Row_fieldWidths[CCGROUP], Row_fieldWidths[CCGROUP], lp->cgroup_short ? lp->cgroup_short : (lp->cgroup ? lp->cgroup : "N/A"));
293+
RichString_appendWide(str, attr, buffer);
294+
return;
295+
case CONTAINER:
296+
xSnprintf(buffer, n, "%-*.*s ", Row_fieldWidths[CONTAINER], Row_fieldWidths[CONTAINER], lp->container_short ? lp->container_short : "N/A");
297+
RichString_appendWide(str, attr, buffer);
298+
return;
290299
case OOM: xSnprintf(buffer, n, "%4u ", lp->oom); break;
291300
case IO_PRIORITY: {
292301
int klass = IOPriority_class(lp->ioPriority);
@@ -317,7 +326,10 @@ static void LinuxProcess_rowWriteField(const Row* super, RichString* str, Proces
317326
}
318327
xSnprintf(buffer, n, "%5lu ", lp->ctxt_diff);
319328
break;
320-
case SECATTR: snprintf(buffer, n, "%-*.*s ", Row_fieldWidths[SECATTR], Row_fieldWidths[SECATTR], lp->secattr ? lp->secattr : "N/A"); break;
329+
case SECATTR:
330+
snprintf(buffer, n, "%-*.*s ", Row_fieldWidths[SECATTR], Row_fieldWidths[SECATTR], lp->secattr ? lp->secattr : "N/A");
331+
RichString_appendWide(str, attr, buffer);
332+
return;
321333
case AUTOGROUP_ID:
322334
if (lp->autogroup_id != -1) {
323335
xSnprintf(buffer, n, "%4ld ", lp->autogroup_id);

0 commit comments

Comments
 (0)