]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
irqtop: trim white spaces from end of name field
authorSami Kerola <kerolasa@iki.fi>
Wed, 4 Mar 2020 21:39:07 +0000 (21:39 +0000)
committerSami Kerola <kerolasa@iki.fi>
Wed, 4 Mar 2020 21:40:24 +0000 (21:40 +0000)
Excess white spaces were easiest to see in json output.

    $ irqtop --once --json
    {
       "interrupts": [
          {"irq":"LOC", "total":7425148, "name":"Local timer interrupts "},
          {"irq":"51", "total":1848384, "name":"IR-PCI-MSI 32768-edge i915 "},
          {"irq":"RES", "total":1176665, "name":"Rescheduling interrupts "},
          ...

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
sys-utils/irqtop.c

index 3c12530058870600de961ad80291d3c67ec875c5..15fa2ff8529cbcf3475eb952c42f91801ee65656 100644 (file)
@@ -324,6 +324,7 @@ static struct irq_stat *get_irqinfo(void)
                        while (isspace(*tmp))
                                tmp++;
                        tmp = remove_repeated_spaces(tmp);
+                       rtrim_whitespace((unsigned char *)tmp);
                        curr->name = xstrdup(tmp);
                } else  /* no irq name string, we have to set '\0' here */
                        curr->name = xstrdup("");