From: Dmitry Goncharov Date: Tue, 23 Aug 2022 01:27:08 +0000 (-0400) Subject: [SV 62908] Don't free fifo_name twice during error handling X-Git-Tag: 4.3.90~28 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=10e130b20793f650835085d5ebe85e4ad0c83654;p=thirdparty%2Fmake.git [SV 62908] Don't free fifo_name twice during error handling * src/posixos.c (jobserver_setup): Set fifo_name to NULL after free. * tests/scripts/features/jobserver: Add tests. --- diff --git a/src/posixos.c b/src/posixos.c index 2629cd82..3ab487c1 100644 --- a/src/posixos.c +++ b/src/posixos.c @@ -115,6 +115,7 @@ jobserver_setup (int slots, const char *style) { perror_with_name("jobserver mkfifo: ", fifo_name); free (fifo_name); + fifo_name = NULL; } else { diff --git a/tests/scripts/features/jobserver b/tests/scripts/features/jobserver index 7044c51a..17374eaf 100644 --- a/tests/scripts/features/jobserver +++ b/tests/scripts/features/jobserver @@ -131,4 +131,19 @@ all a: ; @echo $@ '--jobserver-style=foo -j8', "#MAKE#: *** Unknown jobserver auth style 'foo'. Stop.", 512); +# sv 62908. +# Test that when mkfifo fails, make switches to pipe and succeeds. +# Force mkfifo to fail by attempting to create a fifo in a non existent +# directory. +# run_make_test does not allow matching a multiline pattern, therefore run the +# test twice. +# First time look for /$ERR_no_such_file/ to ensure mkfifo failed. +# Second time look for /Nothing to be done/ to ensure make succeeded. +$ENV{TMPDIR} = "nosuchdir"; +run_make_test("all:\n", '-j2', "/$ERR_no_such_file/"); + +$ENV{TMPDIR} = "nosuchdir"; +run_make_test(undef, '-j2', "/Nothing to be done/"); + + 1;