[sandbox 2/3] Only show dhclient output in debug mode.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list



[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]