Merge authors:
  James Hunt (jamesodhunt)
Related merge proposals:
  https://code.launchpad.net/~jamesodhunt/upstart/bug-1197225/+merge/172762
  proposed by: James Hunt (jamesodhunt)
------------------------------------------------------------
revno: 1499 [merge]
committer: Dmitrijs Ledkovs <[email protected]>
branch nick: upstart
timestamp: Wed 2013-07-03 09:36:59 +0100
message:
  Merge lp:~jamesodhunt/upstart/bug-1197225
modified:
  ChangeLog
  extra/upstart-dbus-bridge.c
  extra/upstart-event-bridge.c
  extra/upstart-file-bridge.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	2013-06-28 13:21:34 +0000
+++ ChangeLog	2013-07-03 08:26:23 +0000
@@ -1,3 +1,12 @@
+2013-07-03  James Hunt  <[email protected]>
+
+	* extra/upstart-dbus-bridge.c: main(): Check nih_str_split() return.
+	* extra/upstart-event-bridge.c: main(): Check nih_str_split() return.
+	* extra/upstart-file-bridge.c: main():
+	  - Check nih_str_split() return.
+	  - Only attempt to extract PID from UPSTART_SESSION
+	    in user mode (LP: #1197225).
+
 2013-06-28  James Hunt  <[email protected]>
 
 	* NEWS: Release 1.9

=== modified file 'extra/upstart-dbus-bridge.c'
--- extra/upstart-dbus-bridge.c	2013-06-26 09:15:41 +0000
+++ extra/upstart-dbus-bridge.c	2013-07-03 08:26:23 +0000
@@ -297,7 +297,8 @@
 		if (user_mode) {
 			/* Extract PID from UPSTART_SESSION */
 			user_session_path = nih_str_split (NULL, user_session_addr, "/", TRUE);
-			for (int i = 0; user_session_path[i] != NULL; i++)
+
+			for (int i = 0; user_session_path && user_session_path[i]; i++)
 				path_element = user_session_path[i];
 
 			if (! path_element) {

=== modified file 'extra/upstart-event-bridge.c'
--- extra/upstart-event-bridge.c	2013-01-23 19:18:43 +0000
+++ extra/upstart-event-bridge.c	2013-07-03 08:26:23 +0000
@@ -209,7 +209,8 @@
 
 		/* Extract PID from UPSTART_SESSION */
 		user_session_path = nih_str_split (NULL, user_session_addr, "/", TRUE);
-		for (int i = 0; user_session_path[i] != NULL; i++)
+
+		for (int i = 0; user_session_path && user_session_path[i]; i++)
 			path_element = user_session_path[i];
 
 		if (! path_element) {

=== modified file 'extra/upstart-file-bridge.c'
--- extra/upstart-file-bridge.c	2013-03-28 16:55:36 +0000
+++ extra/upstart-file-bridge.c	2013-07-03 08:26:23 +0000
@@ -547,24 +547,28 @@
 		 * the Upstart instance (last part of the DBus path) in the filename.
 		 */
 
-		/* Extract PID from UPSTART_SESSION */
-		user_session_path = nih_str_split (NULL, user_session_addr, "/", TRUE);
-		for (int i = 0; user_session_path[i] != NULL; i++)
-			path_element = user_session_path[i];
-
-		if (! path_element) {
-			nih_fatal (_("Invalid value for UPSTART_SESSION"));
-			exit (1);
-		}
-
-		pidfile_path = getenv ("XDG_RUNTIME_DIR");
-		if (! pidfile_path)
-			pidfile_path = getenv ("HOME");
-
-		if (pidfile_path) {
-			NIH_MUST (nih_strcat_sprintf (&pidfile, NULL, "%s/upstart-file-bridge.%s.pid",
-					                        pidfile_path, path_element));
-			nih_main_set_pidfile (pidfile);
+		if (user) {
+
+			/* Extract PID from UPSTART_SESSION */
+			user_session_path = nih_str_split (NULL, user_session_addr, "/", TRUE);
+
+			for (int i = 0; user_session_path && user_session_path[i]; i++)
+				path_element = user_session_path[i];
+
+			if (! path_element) {
+				nih_fatal (_("Invalid value for UPSTART_SESSION"));
+				exit (1);
+			}
+
+			pidfile_path = getenv ("XDG_RUNTIME_DIR");
+			if (! pidfile_path)
+				pidfile_path = getenv ("HOME");
+
+			if (pidfile_path) {
+				NIH_MUST (nih_strcat_sprintf (&pidfile, NULL, "%s/upstart-file-bridge.%s.pid",
+							pidfile_path, path_element));
+				nih_main_set_pidfile (pidfile);
+			}
 		}
 
 		if (nih_main_daemonise () < 0) {

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

Reply via email to