mirror of
https://git.FreeBSD.org/src.git
synced 2025-01-11 14:10:34 +00:00
sh: make smark a static variable instead of a local in main()
We are modifying it after setjmp and then accessing it after the jump, so it cannot be a local. MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D40415
This commit is contained in:
parent
1320520ba4
commit
2178e8c27a
@ -100,7 +100,13 @@ static char *find_dot_file(char *);
|
|||||||
int
|
int
|
||||||
main(int argc, char *argv[])
|
main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
struct stackmark smark = {0}, smark2;
|
/*
|
||||||
|
* As smark is accessed after a longjmp, it cannot be a local in main().
|
||||||
|
* The C standard specifies that the values of non-volatile local
|
||||||
|
* variables are unspecified after a jump if modified between the
|
||||||
|
* setjmp and longjmp.
|
||||||
|
*/
|
||||||
|
static struct stackmark smark, smark2;
|
||||||
volatile int state;
|
volatile int state;
|
||||||
char *shinit;
|
char *shinit;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user