]> git.ipfire.org Git - thirdparty/kmod.git/commit
tools/rmmod: fix garbled error message
authorYannick Le Pennec <yannick.lepennec@live.fr>
Mon, 24 Mar 2025 17:35:53 +0000 (18:35 +0100)
committerLucas De Marchi <lucas.de.marchi@gmail.com>
Fri, 28 Mar 2025 15:52:10 +0000 (10:52 -0500)
commit95275d23fb269f67e427535bb39df961b03e9484
tree11e87e3720caf9d2f91fdca455ac641881ffbc51
parent13330c958deef15c227a9c83d8ba72106152fd7f
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
(cherry picked from commit da2654b78ce3af083e42c2f7512d09082b872676)
tools/rmmod.c