[PATCH 4/4] Make variables seq and toact volatile to fix setjmp warning

Pavel Roskin proski at gnu.org
Sun Feb 7 01:54:57 UTC 2010


Without that patch, gcc warns:

script.c: In function 'expect':
script.c:514: warning: variable 'seq' might be clobbered by 'longjmp' or
'vfork'
script.c:517: warning: variable 'toact' might be clobbered by 'longjmp'
or 'vfork'
---
 src/script.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/script.c b/src/script.c
index beeab21..d259df1 100644
--- a/src/script.c
+++ b/src/script.c
@@ -511,10 +511,10 @@ struct line **buildexpect(void)
 int expect(char *text)
 {
   char *s, *w;
-  struct line **seq;
+  struct line **volatile seq;
   struct line oneline;
   struct line *dflseq[2];
-  char *toact = "exit 1";
+  char *volatile toact = "exit 1";
   volatile int found = 0;
   int f, val, c;
   char *action = NULL;



More information about the minicom-devel mailing list