da2654b
authorMarco d'Itri <md@linux.it>
Fri, 25 Apr 2025 09:50:41 +0000 (11:50 +0200)
committerMarco d'Itri <md@linux.it>
Fri, 25 Apr 2025 09:50:41 +0000 (11:50 +0200)
commit62d6c3214dd320a00eb7fa40426595e49998272e
tree1df40c8346120693d3317c5ff4e181fa2e524055
parent0ae7801aa8ac8f78d4767e073ca1f563a79f9d63
da2654b

commit da2654b78ce3af083e42c2f7512d09082b872676
Author: Yannick Le Pennec <yannick.lepennec@live.fr>
Date:   Mon Mar 24 18:35:53 2025 +0100

    tools/rmmod: fix garbled error message

    a6f9cd0 ("tools/rmmod: consistently use ERR logging facility") fixed
    the split between syslog and stderr of various error message substrings
    by calling the ERR macro instead of writing directly to stderr, but in
    doing so also completely mangled the output because the ERR macro
    decorates its arguments:

        $ rmmod iwlwifi
        rmmod: ERROR: Module iwlwifi is in use by:rmmod: ERROR:  iwlmvmrmmod: ERROR:

    And in syslog:

        $ rmmod -s iwlwifi
        2025-03-24T17:22:34.878318+01:00 mangolassi rmmod: ERROR: Module iwlwifi is in use by:
        2025-03-24T17:22:34.889145+01:00 mangolassi rmmod: ERROR:  iwlmvm
        2025-03-24T17:22:34.889224+01:00 mangolassi rmmod: ERROR:

    This commit fixes that by building the holder names list with a strbuf
    and then passes the whole thing at once to ERR.

Fixes: a6f9cd0 ("tools/rmmod: consistently use ERR logging facility")
Signed-off-by: Yannick Le Pennec <yannick.lepennec@live.fr>
Link: https://lore.kernel.org/r/VI1PR02MB48291E3BDB7E764ED67154949BA42@VI1PR02MB4829.eurprd02.prod.outlook.com
Signed-off-by: Lucas De Marchi <lucas.de.marchi@gmail.com>
Link: https://github.com/kmod-project/kmod/pull/328
Gbp-Pq: Name da2654b
tools/rmmod.c