~cjwatson/upstart/state-changed

« back to all changes in this revision

Viewing changes to init/job_process.c

  • Committer: Scott James Remnant
  • Date: 2010-02-26 15:31:13 UTC
  • Revision ID: scott@netsplit.com-20100226153113-z0hm2x2jnncmrmro
* init/job_process.c (job_process_run): Since /proc is always mounted,
guaranteed because we mount it ourselves if it isn't, we don't need
to check for it and can always use /proc/self/fd/NNN when we want.
* init/tests/test_job_process.c (test_run): Since /proc is always
mounted, we don't need to check for it and skip tests.

Show diffs side-by-side

added added

removed removed

Lines of Context:
155
155
         * the best way to deal with things like variables.
156
156
         */
157
157
        if ((proc->script) || strpbrk (proc->command, SHELL_CHARS)) {
158
 
                struct stat  statbuf;
159
 
                char        *nl, *p;
 
158
                char *nl, *p;
160
159
 
161
160
                argc = 0;
162
161
                argv = NIH_MUST (nih_str_array_new (NULL));
175
174
                                                        proc->command));
176
175
                }
177
176
 
178
 
                /* We can pass scripts over the command-line instead of
179
 
                 * piping using /proc/self/fd/NNN.  Do it for single line
180
 
                 * scripts and when /proc/self/fd doesn't exist.
 
177
                /* Don't pipe single-line scripts into the shell using
 
178
                 * /proc/self/fd/NNN, instead just pass them over the
 
179
                 * command-line (taking care to strip off the trailing
 
180
                 * newlines).
181
181
                 */
182
182
                p = nl = strchr (script, '\n');
183
183
                while (p && (*p == '\n'))
184
184
                        p++;
185
185
 
186
 
                if ((! nl) || (! *p)
187
 
                    || (stat ("/proc/self/fd", &statbuf) < 0)
188
 
                    || (! S_ISDIR (statbuf.st_mode))) {
 
186
                if ((! nl) || (! *p)) {
189
187
                        /* Strip off the newline(s) */
190
 
                        if (nl && (! *p))
 
188
                        if (nl)
191
189
                                *nl = '\0';
192
190
 
193
191
                        NIH_MUST (nih_str_array_add (&argv, NULL,