Merge authors:
  James Hunt (jamesodhunt)
  Steve Langasek (vorlon)
------------------------------------------------------------
revno: 1401 [merge]
committer: Steve Langasek <[email protected]>
branch nick: upstream
timestamp: Fri 2012-12-07 10:26:43 -0800
message:
  Merge fix for 'telinit u' returning an error due to dbus disconnect
modified:
  ChangeLog
  dbus/com.ubuntu.Upstart.xml
  util/telinit.c


--
lp:upstart
https://code.launchpad.net/~upstart-devel/upstart/trunk

Your team Upstart Reviewers is subscribed to branch lp:upstart.
To unsubscribe from this branch go to 
https://code.launchpad.net/~upstart-devel/upstart/trunk/+edit-subscription
=== modified file 'ChangeLog'
--- ChangeLog	2012-12-07 09:46:45 +0000
+++ ChangeLog	2012-12-07 18:26:43 +0000
@@ -3,6 +3,11 @@
 	* init/Makefile.am:
 	  - TEST_DATA_DIR: use $srcdir, not $PWD.
 	  - TEST_DATA_FILES: Corrected filename.
+	* dbus/com.ubuntu.Upstart.xml: Restart: Add annotation to make it
+	  manifest this is an async call.
+	* util/telinit.c: restart_upstart(): Use the async call to avoid the
+	  client-side complaining if it detects that Upstart has severed all
+	  D-Bus connections in preparation for the re-exec.
 
 2012-12-06  James Hunt  <[email protected]>
 

=== modified file 'dbus/com.ubuntu.Upstart.xml'
--- dbus/com.ubuntu.Upstart.xml	2012-12-06 17:30:31 +0000
+++ dbus/com.ubuntu.Upstart.xml	2012-12-07 18:26:43 +0000
@@ -38,7 +38,9 @@
       <arg name="state" type="s" direction="out" />
     </method>
 
-    <method name="Restart"/>
+    <method name="Restart">
+      <annotation name="com.netsplit.Nih.Method.Async" value="true" />
+    </method>
 
     <!-- Signals for changes to the job list -->
     <signal name="JobAdded">

=== modified file 'util/telinit.c'
--- util/telinit.c	2012-12-06 11:38:02 +0000
+++ util/telinit.c	2012-12-07 16:56:08 +0000
@@ -161,13 +161,25 @@
 restart_upstart (void)
 {
 	nih_local NihDBusProxy *upstart = NULL;
+	DBusPendingCall        *ret;
 
 	upstart = upstart_open (NULL);
 	if (! upstart)
 		return -1;
 
-	if (upstart_restart_sync (NULL, upstart) < 0)
-		return -1;
+	/* Fire and forget:
+	 *
+	 * Ask Upstart to restart itself using the async interface to
+	 * avoid the client-side complaining if and when it detects that
+	 * Upstart has severed all connections to perform the re-exec.
+	 */
+	ret = upstart_restart (upstart, NULL, NULL, NULL, 0);
+
+	/* We don't care about the return code, but we have to keep
+	 * the compiler happy.
+	 */
+	if (ret != (DBusPendingCall *)TRUE)
+		return 0;
 
 	return 0;
 }

-- 
upstart-devel mailing list
[email protected]
Modify settings or unsubscribe at: 
https://lists.ubuntu.com/mailman/listinfo/upstart-devel

Reply via email to