From: Andreas Schwab Date: Sat, 19 Jan 2019 22:18:16 +0000 (+0100) Subject: setarch: don't return address of automatic variable X-Git-Tag: v2.33.2~33 X-Git-Url: http://git.ipfire.org/gitweb/gitweb.cgi?a=commitdiff_plain;h=24b1741940c50a81b5914cc2b71a189f15a708ef;p=thirdparty%2Futil-linux.git setarch: don't return address of automatic variable On architectures without special personalities setarch uses the contents of a local variable with automatic storage duration after return from the function, causing it to report a spurious error. $ setarch m68k setarch: Kernel cannot set architecture to m68k Signed-off-by: Andreas Schwab --- diff --git a/sys-utils/setarch.c b/sys-utils/setarch.c index 7c0a63fbb2..703c36d864 100644 --- a/sys-utils/setarch.c +++ b/sys-utils/setarch.c @@ -131,7 +131,7 @@ static void __attribute__((__noreturn__)) usage(int archwrapper) */ static struct arch_domain *init_arch_domains(void) { - struct utsname un; + static struct utsname un; size_t i; static struct arch_domain transitions[] =