------------------------------------------------------------
revno: 1423
committer: James Hunt <[email protected]>
branch nick: upstart-setenv+getenv
timestamp: Mon 2013-01-28 11:25:25 +0000
message:
  * util/initctl.c:
    - get_job_details(): Fix order in which arguments are checked.
modified:
  ChangeLog
  util/initctl.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-01-28 10:10:15 +0000
+++ ChangeLog	2013-01-28 11:25:25 +0000
@@ -7,6 +7,9 @@
 	  - Added --job, --instance, --global options for list-env, set-env,
 	    get-env, unset-env, reset-env.
 	  - Explain PID 1 limitation for set-env, unset-env, reset-env.
+	* util/initctl.c:
+	  - get_job_details(): Fix order in which arguments are
+	    checked.
 
 2013-01-25  James Hunt  <[email protected]>
 

=== modified file 'util/initctl.c'
--- util/initctl.c	2013-01-25 20:08:49 +0000
+++ util/initctl.c	2013-01-28 11:25:25 +0000
@@ -2703,14 +2703,12 @@
 	if (! details)
 		return NULL;
 
-	/* The global option trounces all others */
-	if (apply_globally) {
-		upstart_job = upstart_instance = NULL;
-	} else if (job_name) {
+	if (job_name) {
 		upstart_job = job_name;
 		upstart_instance = job_instance ? job_instance : "";
-	} else {
-		upstart_job = getenv ("UPSTART_JOB");
+	} else if (apply_globally) {
+		upstart_job = upstart_instance = NULL;
+	} else if ((upstart_job = getenv ("UPSTART_JOB")) != NULL) {
 		upstart_instance = getenv ("UPSTART_INSTANCE");
 
 		if (! (upstart_job && upstart_instance)) {
@@ -2718,6 +2716,10 @@
 			nih_main_suggest_help ();
 			return NULL;
 		}
+	} else {
+		/* Running outside of job implies global */
+		apply_globally = TRUE;
+		upstart_job = upstart_instance = NULL;
 	}
 
 	if (upstart_job) {

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

Reply via email to