Stéphane Graber has proposed merging lp:~stgraber/upstart/upstart-user-cwd into 
lp:upstart.

Requested reviews:
  Upstart Reviewers (upstart-reviewers)

For more details, see:
https://code.launchpad.net/~stgraber/upstart/upstart-user-cwd/+merge/147468

The default code in upstart was to chdir to / all jobs that don't have
an explicit chdir stanza. This isn't the wanted behaviour for user jobs
where we want CWD to be inherited.

This change simply adds an explicit check for user sessions.
-- 
https://code.launchpad.net/~stgraber/upstart/upstart-user-cwd/+merge/147468
Your team Upstart Reviewers is requested to review the proposed merge of 
lp:~stgraber/upstart/upstart-user-cwd into lp:upstart.
=== modified file 'init/job_process.c'
--- init/job_process.c	2013-01-25 09:08:09 +0000
+++ init/job_process.c	2013-02-08 20:44:27 +0000
@@ -765,9 +765,11 @@
 	 * configured in the job, or to the root directory of the filesystem
 	 * (or at least relative to the chroot).
 	 */
-	if (chdir (class->chdir ? class->chdir : "/") < 0) {
-		nih_error_raise_system ();
-		job_process_error_abort (fds[1], JOB_PROCESS_ERROR_CHDIR, 0);
+	if (class->chdir || user_mode == FALSE) {
+		if (chdir (class->chdir ? class->chdir : "/") < 0) {
+			nih_error_raise_system ();
+			job_process_error_abort (fds[1], JOB_PROCESS_ERROR_CHDIR, 0);
+		}
 	}
 
 	/* Change the user and group of the process to the one

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

Reply via email to