]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
setarch: don't return address of automatic variable
authorAndreas Schwab <schwab@linux-m68k.org>
Sat, 19 Jan 2019 22:18:16 +0000 (23:18 +0100)
committerKarel Zak <kzak@redhat.com>
Tue, 2 Apr 2019 10:16:11 +0000 (12:16 +0200)
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 <schwab@linux-m68k.org>
sys-utils/setarch.c

index 7c0a63fbb262bf8d1d49c25966cda289ec70b15d..703c36d864e150f701cefeeb58b9e44e272208c7 100644 (file)
@@ -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[] =