diff options
author | Chang Rebecca Swee Fun <rebecca.swee.fun.chang@intel.com> | 2016-03-10 12:01:48 +0800 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2016-03-11 16:50:28 +0000 |
commit | 0fe2a4b428b1b9a937914d87ec089b5a64f641eb (patch) | |
tree | 0306efae88524d43e9a64f58c8ac449e48eae3c5 /meta/recipes-devtools | |
parent | 18f127765f1cdcf531f29c58641a256c199d888c (diff) | |
download | openembedded-core-0fe2a4b428b1b9a937914d87ec089b5a64f641eb.tar.gz openembedded-core-0fe2a4b428b1b9a937914d87ec089b5a64f641eb.tar.bz2 openembedded-core-0fe2a4b428b1b9a937914d87ec089b5a64f641eb.zip |
make 4.1: fix segfault when ttyname fails
GNU make segfaults when run in a chroot environment because
of a known bug in GNU make 4.1. See [1] for details.
Works if /dev/pts is mounted before chroot.
[1] http://savannah.gnu.org/bugs/?43434
[YOCTO #9067]
Reported-by: Alexander Larsson <alexl@redhat.com>
Signed-off-by: Anuj Mittal <anujx.mittal@intel.com>
Signed-off-by: Chang Rebecca Swee Fun <rebecca.swee.fun.chang@intel.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
Diffstat (limited to 'meta/recipes-devtools')
-rw-r--r-- | meta/recipes-devtools/make/make-4.1/0001-main.c-main-SV-43434-Handle-NULL-returns-from-ttynam.patch | 63 | ||||
-rw-r--r-- | meta/recipes-devtools/make/make_4.1.bb | 2 |
2 files changed, 65 insertions, 0 deletions
diff --git a/meta/recipes-devtools/make/make-4.1/0001-main.c-main-SV-43434-Handle-NULL-returns-from-ttynam.patch b/meta/recipes-devtools/make/make-4.1/0001-main.c-main-SV-43434-Handle-NULL-returns-from-ttynam.patch new file mode 100644 index 0000000000..7a5f4ba055 --- /dev/null +++ b/meta/recipes-devtools/make/make-4.1/0001-main.c-main-SV-43434-Handle-NULL-returns-from-ttynam.patch @@ -0,0 +1,63 @@ +From 292da6f6867b75a5af7ddbb639a1feae022f438f Mon Sep 17 00:00:00 2001 +From: Paul Smith <psmith@gnu.org> +Date: Mon, 20 Oct 2014 01:54:56 -0400 +Subject: [PATCH] * main.c (main): [SV 43434] Handle NULL returns from + ttyname(). + +Upstream-Status: Backport + +From: http://git.savannah.gnu.org/cgit/make.git/commit/?id=292da6f6867b75a5af7ddbb639a1feae022f438f + +--- + main.c | 15 ++++++++++----- + makeint.h | 3 ++- + 2 files changed, 12 insertions(+), 6 deletions(-) + +diff --git a/main.c b/main.c +index b2d169c..0cdb8a8 100644 +--- a/main.c ++++ b/main.c +@@ -1429,13 +1429,18 @@ main (int argc, char **argv, char **envp) + #ifdef HAVE_ISATTY + if (isatty (fileno (stdout))) + if (! lookup_variable (STRING_SIZE_TUPLE ("MAKE_TERMOUT"))) +- define_variable_cname ("MAKE_TERMOUT", TTYNAME (fileno (stdout)), +- o_default, 0)->export = v_export; +- ++ { ++ const char *tty = TTYNAME (fileno (stdout)); ++ define_variable_cname ("MAKE_TERMOUT", tty ? tty : DEFAULT_TTYNAME, ++ o_default, 0)->export = v_export; ++ } + if (isatty (fileno (stderr))) + if (! lookup_variable (STRING_SIZE_TUPLE ("MAKE_TERMERR"))) +- define_variable_cname ("MAKE_TERMERR", TTYNAME (fileno (stderr)), +- o_default, 0)->export = v_export; ++ { ++ const char *tty = TTYNAME (fileno (stderr)); ++ define_variable_cname ("MAKE_TERMERR", tty ? tty : DEFAULT_TTYNAME, ++ o_default, 0)->export = v_export; ++ } + #endif + + /* Reset in case the switches changed our minds. */ +diff --git a/makeint.h b/makeint.h +index 6223936..2009f41 100644 +--- a/makeint.h ++++ b/makeint.h +@@ -436,10 +436,11 @@ extern struct rlimit stack_limit; + /* The number of bytes needed to represent the largest integer as a string. */ + #define INTSTR_LENGTH CSTRLEN ("18446744073709551616") + ++#define DEFAULT_TTYNAME "true" + #ifdef HAVE_TTYNAME + # define TTYNAME(_f) ttyname (_f) + #else +-# define TTYNAME(_f) "true" ++# define TTYNAME(_f) DEFAULT_TTYNAME + #endif + + +-- +1.9.1 + diff --git a/meta/recipes-devtools/make/make_4.1.bb b/meta/recipes-devtools/make/make_4.1.bb index a1b0d7c45f..78fe0b5471 100644 --- a/meta/recipes-devtools/make/make_4.1.bb +++ b/meta/recipes-devtools/make/make_4.1.bb @@ -4,6 +4,8 @@ LIC_FILES_CHKSUM = "file://COPYING;md5=d32239bcb673463ab874e80d47fae504 \ file://glob/COPYING.LIB;md5=4a770b67e6be0f60da244beb2de0fce4" require make.inc +SRC_URI += "file://0001-main.c-main-SV-43434-Handle-NULL-returns-from-ttynam.patch" + EXTRA_OECONF += "--without-guile" SRC_URI[md5sum] = "57a7a224a822f94789a587ccbcedff69" |