Le lundi, 2 février 2015 08.57:02, vous avez écrit :
> Could you add the patch file to this bug. It seems you forgot to
> attach it in your previous mail.

Damn. :'(

Here you go.

OdyX
From 0d1470eded1dff0d592ff0ed10125d76f3ee46c2 Mon Sep 17 00:00:00 2001
From: Didier Raboud <[email protected]>
Date: Sun, 1 Feb 2015 13:00:37 +0100
Subject: [PATCH] Replace build-time systemd detection by runtime sd_booted()
 toggles

Closes: #770871
---
 src/devices/wwan/nm-modem-manager.c | 97 +++++++++++++++++++------------------
 1 file changed, 49 insertions(+), 48 deletions(-)

diff --git a/src/devices/wwan/nm-modem-manager.c b/src/devices/wwan/nm-modem-manager.c
index c481170..c60e8b3 100644
--- a/src/devices/wwan/nm-modem-manager.c
+++ b/src/devices/wwan/nm-modem-manager.c
@@ -21,6 +21,7 @@
  */

 #include <string.h>
+#include <systemd/sd-daemon.h>
 #include "config.h"
 #include "nm-modem-manager.h"
 #include "nm-logging.h"
@@ -466,10 +467,10 @@ modem_manager_1_name_owner_changed (MMManager *modem_manager_1,
 	if (!name_owner) {
 		nm_log_info (LOGD_MB, "ModemManager disappeared from bus");

-#if !HAVE_SYSTEMD
-		/* If not managed by systemd, schedule relaunch */
-		schedule_modem_manager_1_relaunch (self, 0);
-#endif
+		if (!sd_booted()) {
+			/* If not managed by systemd, schedule relaunch */
+			schedule_modem_manager_1_relaunch (self, 0);
+		}

 		return;
 	}
@@ -490,58 +491,58 @@ modem_manager_1_name_owner_changed (MMManager *modem_manager_1,
 	 */
 }

-#if !HAVE_SYSTEMD
-
 static void
 modem_manager_1_poke_cb (GDBusConnection *connection,
                          GAsyncResult *res,
                          NMModemManager *self)
 {
-	GError *error = NULL;
-	GVariant *result;
-
-	result = g_dbus_connection_call_finish (connection, res, &error);
-	if (error) {
-		/* Ignore common errors when MM is not installed and such */
-		if (   !g_error_matches (error, G_DBUS_ERROR, G_DBUS_ERROR_SERVICE_UNKNOWN)
-		    && !g_error_matches (error, G_DBUS_ERROR, G_DBUS_ERROR_SPAWN_EXEC_FAILED)
-		    && !g_error_matches (error, G_DBUS_ERROR, G_DBUS_ERROR_SPAWN_FORK_FAILED)
-		    && !g_error_matches (error, G_DBUS_ERROR, G_DBUS_ERROR_SPAWN_FAILED)
-		    && !g_error_matches (error, G_DBUS_ERROR, G_DBUS_ERROR_TIMEOUT)
-		    && !g_error_matches (error, G_DBUS_ERROR, G_DBUS_ERROR_SPAWN_SERVICE_NOT_FOUND)) {
-			nm_log_dbg (LOGD_MB, "error poking ModemManager: %s", error->message);
-		}
-		g_error_free (error);
-
-		/* Setup timeout to relaunch */
-		schedule_modem_manager_1_relaunch (self, MODEM_POKE_INTERVAL);
-	} else
-		g_variant_unref (result);
-
-	/* Balance refcount */
-	g_object_unref (self);
+	if (!sd_booted()) {
+		GError *error = NULL;
+		GVariant *result;
+
+		result = g_dbus_connection_call_finish (connection, res, &error);
+		if (error) {
+			/* Ignore common errors when MM is not installed and such */
+			if (   !g_error_matches (error, G_DBUS_ERROR, G_DBUS_ERROR_SERVICE_UNKNOWN)
+			    && !g_error_matches (error, G_DBUS_ERROR, G_DBUS_ERROR_SPAWN_EXEC_FAILED)
+			    && !g_error_matches (error, G_DBUS_ERROR, G_DBUS_ERROR_SPAWN_FORK_FAILED)
+			    && !g_error_matches (error, G_DBUS_ERROR, G_DBUS_ERROR_SPAWN_FAILED)
+			    && !g_error_matches (error, G_DBUS_ERROR, G_DBUS_ERROR_TIMEOUT)
+			    && !g_error_matches (error, G_DBUS_ERROR, G_DBUS_ERROR_SPAWN_SERVICE_NOT_FOUND)) {
+				nm_log_dbg (LOGD_MB, "error poking ModemManager: %s", error->message);
+			}
+			g_error_free (error);
+
+			/* Setup timeout to relaunch */
+			schedule_modem_manager_1_relaunch (self, MODEM_POKE_INTERVAL);
+		} else
+			g_variant_unref (result);
+
+		/* Balance refcount */
+		g_object_unref (self);
+	}
 }

 static void
 modem_manager_1_poke (NMModemManager *self)
 {
-	/* If there is no current owner right away, ensure we poke to get one */
-	g_dbus_connection_call (self->priv->dbus_connection,
-	                        "org.freedesktop.ModemManager1",
-	                        "/org/freedesktop/ModemManager1",
-	                        "org.freedesktop.DBus.Peer",
-	                        "Ping",
-	                        NULL, /* inputs */
-	                        NULL, /* outputs */
-	                        G_DBUS_CALL_FLAGS_NONE,
-	                        -1,
-	                        NULL, /* cancellable */
-	                        (GAsyncReadyCallback)modem_manager_1_poke_cb, /* callback */
-	                        g_object_ref (self)); /* user_data */
+	if (!sd_booted()) {
+		/* If there is no current owner right away, ensure we poke to get one */
+		g_dbus_connection_call (self->priv->dbus_connection,
+					"org.freedesktop.ModemManager1",
+					"/org/freedesktop/ModemManager1",
+					"org.freedesktop.DBus.Peer",
+					"Ping",
+					NULL, /* inputs */
+					NULL, /* outputs */
+					G_DBUS_CALL_FLAGS_NONE,
+					-1,
+					NULL, /* cancellable */
+					(GAsyncReadyCallback)modem_manager_1_poke_cb, /* callback */
+					g_object_ref (self)); /* user_data */
+	}
 }

-#endif /* HAVE_SYSTEMD */
-
 static void
 modem_manager_1_check_name_owner (NMModemManager *self)
 {
@@ -555,10 +556,10 @@ modem_manager_1_check_name_owner (NMModemManager *self)
 		return;
 	}

-#if !HAVE_SYSTEMD
-	/* If the lifecycle is not managed by systemd, poke */
-	modem_manager_1_poke (self);
-#endif
+	if (!sd_booted()) {
+		/* If the lifecycle is not managed by systemd, poke */
+		modem_manager_1_poke (self);
+	}
 }

 static void
--
2.1.4

Attachment: signature.asc
Description: This is a digitally signed message part.

_______________________________________________
Pkg-utopia-maintainers mailing list
[email protected]
http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-utopia-maintainers

Reply via email to