From: Daniel P. Berrangé <berrange(a)redhat.com>
Allow virCommand to find 'modprobe' & 'rmmod' in $PATH. These
commands
are only used when running privileged in which case both 'bin' and
'sbin' dirs will be in $PATH, so virFindFileInPath will do the right
thing to find them.
Signed-off-by: Daniel P. Berrangé <berrange(a)redhat.com>
---
meson.build | 2 --
src/util/virkmod.c | 4 ++--
tests/virkmodtest.c | 4 ++--
3 files changed, 4 insertions(+), 6 deletions(-)
diff --git a/meson.build b/meson.build
index 2a7c264114..3022f0b984 100644
--- a/meson.build
+++ b/meson.build
@@ -854,9 +854,7 @@ optional_test_programs = [
]
optional_programs = [
- 'modprobe',
'ovs-vsctl',
- 'rmmod',
'tc',
] + optional_test_programs
diff --git a/src/util/virkmod.c b/src/util/virkmod.c
index 4c709f8659..111627f4b1 100644
--- a/src/util/virkmod.c
+++ b/src/util/virkmod.c
@@ -29,7 +29,7 @@ doModprobe(const char *opts, const char *module, char **outbuf, char
**errbuf)
{
g_autoptr(virCommand) cmd = NULL;
- cmd = virCommandNewArgList(MODPROBE, opts, NULL);
+ cmd = virCommandNewArgList("modprobe", opts, NULL);
if (module)
virCommandAddArg(cmd, module);
if (outbuf)
@@ -48,7 +48,7 @@ doRmmod(const char *module, char **errbuf)
{
g_autoptr(virCommand) cmd = NULL;
- cmd = virCommandNewArgList(RMMOD, module, NULL);
+ cmd = virCommandNewArgList("rmmod", module, NULL);
virCommandSetErrorBuffer(cmd, errbuf);
if (virCommandRun(cmd, NULL) < 0)
diff --git a/tests/virkmodtest.c b/tests/virkmodtest.c
index ec28ef1282..eb9a2aa740 100644
--- a/tests/virkmodtest.c
+++ b/tests/virkmodtest.c
@@ -63,7 +63,7 @@ testKModLoad(const void *args G_GNUC_UNUSED)
return -1;
}
- if (checkOutput(&buf, MODPROBE " -b " MODNAME "\n") < 0)
+ if (checkOutput(&buf, "modprobe -b " MODNAME "\n") < 0)
return -1;
return 0;
@@ -85,7 +85,7 @@ testKModUnload(const void *args G_GNUC_UNUSED)
return -1;
}
- if (checkOutput(&buf, RMMOD " " MODNAME "\n") < 0)
+ if (checkOutput(&buf, "rmmod " MODNAME "\n") < 0)
return -1;
return 0;
--
2.49.0