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

[libvirt] [PATCH 1/2] v1.1 for dhclient use g_spawn_sync()



This patch addresses problem RHBZ #1133686.

For some (unknown to me) reason, g_spawn_async() is not
starting dhclient so that a dhcp NIC can be configured.
However, simply using g_spawn_sync() works.  This was the
only use of g_spawn_async().

Note: There is no problem using sync instead of async since dhclient will
disconnect and put itself in the background once the network is started.
---
 libvirt-sandbox/libvirt-sandbox-init-common.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/libvirt-sandbox/libvirt-sandbox-init-common.c b/libvirt-sandbox/libvirt-sandbox-init-common.c
index e5f8af0..49baa5c 100644
--- a/libvirt-sandbox/libvirt-sandbox-init-common.c
+++ b/libvirt-sandbox/libvirt-sandbox-init-common.c
@@ -113,10 +113,8 @@ static gboolean start_dhcp(const gchar *devname, GError **error)
 {
     const gchar *argv[] = { "/sbin/dhclient", "--no-pid", devname, NULL };
 
-    if (!g_spawn_async(NULL, (gchar**)argv, NULL,
-                       G_SPAWN_STDOUT_TO_DEV_NULL |
-                       G_SPAWN_STDERR_TO_DEV_NULL,
-                       NULL, NULL, NULL, error))
+    if (!g_spawn_sync(NULL, (gchar**)argv, NULL, 0,
+                      NULL, NULL, NULL, NULL, NULL, error))
         return FALSE;
 
     return TRUE;
-- 
1.9.3


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