Merge lp:~jamesodhunt/upstart/bug-1338968 into lp:upstart

Proposed by James Hunt
Status: Merged
Merged at revision: 1644
Proposed branch: lp:~jamesodhunt/upstart/bug-1338968
Merge into: lp:upstart
Diff against target: 81 lines (+23/-15)
2 files modified
ChangeLog (+7/-0)
init/job_process.c (+16/-15)
To merge this branch: bzr merge lp:~jamesodhunt/upstart/bug-1338968
Reviewer Review Type Date Requested Status
Upstart Reviewers Pending
Review via email: mp+225981@code.launchpad.net
To post a comment you must log in.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'ChangeLog'
--- ChangeLog 2014-07-08 10:02:43 +0000
+++ ChangeLog 2014-07-08 14:12:55 +0000
@@ -3,6 +3,13 @@
3 * init/main.c: main():3 * init/main.c: main():
4 - Only create inotify watches if not restarting or if performing a4 - Only create inotify watches if not restarting or if performing a
5 stateless re-exec (LP: #1338637).5 stateless re-exec (LP: #1338637).
6 * init/job_process.c:
7 - job_process_data_serialise():
8 - Unconditionally toggle CLOEXEC for job_process_fd (LP: #1338968).
9 - Disregard valid flag when toggling CLOEXEC for script_fd since if
10 the JobProcessData still exists, we need the fd to persist across
11 the re-exec.
12 - job_process_data_deserialise(): As above.
613
72014-07-07 James Hunt <james.hunt@ubuntu.com>142014-07-07 James Hunt <james.hunt@ubuntu.com>
815
916
=== modified file 'init/job_process.c'
--- init/job_process.c 2014-07-03 08:59:30 +0000
+++ init/job_process.c 2014-07-08 14:12:55 +0000
@@ -2707,6 +2707,8 @@
2707 if (! process_data)2707 if (! process_data)
2708 return json;2708 return json;
27092709
2710 nih_assert (process_data->job_process_fd != -1);
2711
2710 /* XXX: Note that Job is not serialised; it's not necessary2712 /* XXX: Note that Job is not serialised; it's not necessary
2711 * since the JobProcessData itself is serialised within its Job2713 * since the JobProcessData itself is serialised within its Job
2712 * and the job pointer can be reinstated on deserialisation.2714 * and the job pointer can be reinstated on deserialisation.
@@ -2720,18 +2722,17 @@
2720 if (! state_set_json_string_var_from_obj (json, process_data, script))2722 if (! state_set_json_string_var_from_obj (json, process_data, script))
2721 goto error;2723 goto error;
27222724
2723 if (process_data->shell_fd != -1 && process_data->valid) {2725 /* Clear the cloexec flag to ensure the descriptors
27242726 * remains open across the re-exec.
2725 /* Clear the cloexec flag to ensure the descriptors2727 */
2726 * remains open across the re-exec.2728 if (process_data->shell_fd != -1) {
2727 */
2728 if (state_modify_cloexec (process_data->shell_fd, FALSE) < 0)2729 if (state_modify_cloexec (process_data->shell_fd, FALSE) < 0)
2729 goto error;2730 goto error;
2730
2731 if (state_modify_cloexec (process_data->job_process_fd, FALSE) < 0)
2732 goto error;
2733 }2731 }
27342732
2733 if (state_modify_cloexec (process_data->job_process_fd, FALSE) < 0)
2734 goto error;
2735
2735 if (! state_set_json_int_var_from_obj (json, process_data, shell_fd))2736 if (! state_set_json_int_var_from_obj (json, process_data, shell_fd))
2736 goto error;2737 goto error;
27372738
@@ -2797,17 +2798,17 @@
2797 if (! state_get_json_int_var_to_obj (json, process_data, valid))2798 if (! state_get_json_int_var_to_obj (json, process_data, valid))
2798 goto error;2799 goto error;
27992800
2800 if (process_data->shell_fd != -1 && process_data->valid) {2801 /* Reset the cloexec flag to ensure the descriptors
2801 /* Reset the cloexec flag to ensure the descriptors2802 * are not leaked to any child processes.
2802 * are not leaked to any child processes.2803 */
2803 */2804 if (process_data->shell_fd != -1) {
2804 if (state_modify_cloexec (process_data->shell_fd, TRUE) < 0)2805 if (state_modify_cloexec (process_data->shell_fd, TRUE) < 0)
2805 goto error;2806 goto error;
2806
2807 if (state_modify_cloexec (process_data->job_process_fd, TRUE) < 0)
2808 goto error;
2809 }2807 }
28102808
2809 if (state_modify_cloexec (process_data->job_process_fd, TRUE) < 0)
2810 goto error;
2811
2811 return process_data;2812 return process_data;
28122813
2813error:2814error:

Subscribers

People subscribed via source and target branches