* [PATCH] setarch: don't return address of automatic variable
@ 2019-01-19 22:18 Andreas Schwab
2019-01-22 11:02 ` Karel Zak
0 siblings, 1 reply; 2+ messages in thread
From: Andreas Schwab @ 2019-01-19 22:18 UTC (permalink / raw)
To: util-linux
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 | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/sys-utils/setarch.c b/sys-utils/setarch.c
index 7c0a63fbb262..703c36d864e1 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[] =
--
2.20.1
--
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 7578 EB47 D4E5 4D69 2510 2552 DF73 E780 A9DA AEC1
"And now for something completely different."
^ permalink raw reply related [flat|nested] 2+ messages in thread
end of thread, other threads:[~2019-01-22 11:02 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-01-19 22:18 [PATCH] setarch: don't return address of automatic variable Andreas Schwab
2019-01-22 11:02 ` Karel Zak
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).