We surely don't want to mix dhclient and user's command output,
make sure dhclient is verbose only if LIBVIRT_SANDBOX_DEBUG is set
to 2.
---
 libvirt-sandbox/libvirt-sandbox-init-common.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/libvirt-sandbox/libvirt-sandbox-init-common.c 
b/libvirt-sandbox/libvirt-sandbox-init-common.c
index d35f760..6008739 100644
--- a/libvirt-sandbox/libvirt-sandbox-init-common.c
+++ b/libvirt-sandbox/libvirt-sandbox-init-common.c
@@ -159,11 +159,19 @@ start_shell(void)
 
 static gboolean start_dhcp(const gchar *devname, GError **error)
 {
-    const gchar *argv[] = { "/sbin/dhclient", "-v", "--no-pid", devname, NULL 
};
+    const gchar *argv[5];
+    size_t nargs = 0;
     gboolean ret;
     sigset_t newset;
     sigset_t oldset;
 
+    argv[nargs++] = "/sbin/dhclient";
+    if (debug)
+        argv[nargs++] = "-v";
+    argv[nargs++] = "--no-pid";
+    argv[nargs++] = devname;
+    argv[nargs++] = NULL;
+
     sigemptyset(&newset);
     sigaddset(&newset, SIGHUP);
 
-- 
2.1.4

--
libvir-list mailing list
[email protected]
https://www.redhat.com/mailman/listinfo/libvir-list

Reply via email to