------------------------------------------------------------ revno: 1380 committer: James Hunt <[email protected]> branch nick: upstart timestamp: Mon 2012-10-22 14:29:45 +0100 message: * init/parse_job.c: stanza_kill(): Actually save parsed value to avoid crash if kill signal given as a numeric (LP: #1049820). * init/tests/test_parse_job.c: test_stanza_kill(): New test: "with signal and single numeric argument". modified: ChangeLog init/parse_job.c init/tests/test_parse_job.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 2012-08-31 21:01:48 +0000 +++ ChangeLog 2012-10-22 13:29:45 +0000 @@ -1,3 +1,11 @@ +2012-10-22 James Hunt <[email protected]> + + * init/parse_job.c: stanza_kill(): Actually save parsed + value to avoid crash if kill signal given as a numeric + (LP: #1049820). + * init/tests/test_parse_job.c: test_stanza_kill(): New test: + "with signal and single numeric argument". + 2012-08-31 Steve Langasek <[email protected]> [ A. Costa <[email protected]> ] === modified file 'init/parse_job.c' --- init/parse_job.c 2012-02-16 15:45:41 +0000 +++ init/parse_job.c 2012-10-22 13:29:45 +0000 @@ -1869,6 +1869,8 @@ if (errno || *endptr || (status > INT_MAX)) nih_return_error (-1, PARSE_ILLEGAL_SIGNAL, _(PARSE_ILLEGAL_SIGNAL_STR)); + + signal = status; } /* Set the signal */ === modified file 'init/tests/test_parse_job.c' --- init/tests/test_parse_job.c 2012-02-16 15:45:41 +0000 +++ init/tests/test_parse_job.c 2012-10-22 13:29:45 +0000 @@ -4870,6 +4870,40 @@ nih_free (job); } + /* Check that a kill stanza with the signal argument and numeric signal, + * sets the right signal on the jobs class. + */ + TEST_FEATURE ("with signal and single numeric argument"); + strcpy (buf, "kill signal 30\n"); + + TEST_ALLOC_FAIL { + pos = 0; + lineno = 1; + job = parse_job (NULL, NULL, NULL, "test", buf, strlen (buf), + &pos, &lineno); + + if (test_alloc_failed) { + TEST_EQ_P (job, NULL); + + err = nih_error_get (); + TEST_EQ (err->number, ENOMEM); + nih_free (err); + + continue; + } + + TEST_EQ (pos, strlen (buf)); + TEST_EQ (lineno, 2); + + TEST_ALLOC_SIZE (job, sizeof (JobClass)); + + /* Don't check symbolic here since different + * architectures have different mappings. + */ + TEST_EQ (job->kill_signal, 30); + + nih_free (job); + } /* Check that the last of multiple kill stanzas is used. */
-- upstart-devel mailing list [email protected] Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/upstart-devel
