m4-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Changes to m4/src/stackovf.c,v


From: Eric Blake
Subject: Changes to m4/src/stackovf.c,v
Date: Thu, 03 Aug 2006 13:15:45 +0000

CVSROOT:        /sources/m4
Module name:    m4
Changes by:     Eric Blake <ericb>      06/08/03 13:15:43

Index: src/stackovf.c
===================================================================
RCS file: /sources/m4/m4/src/stackovf.c,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -b -r1.19 -r1.20
--- src/stackovf.c      22 Jul 2006 22:38:14 -0000      1.19
+++ src/stackovf.c      3 Aug 2006 13:15:43 -0000       1.20
@@ -124,7 +124,7 @@
 extern int     sigvec          (int, struct sigvec *, struct sigvec *);
 #endif
 
-static const char *stackbuf;
+static void *stackbuf;
 static const char *stackbot;
 static const char *stackend;
 static const char *arg0;
@@ -365,14 +365,21 @@
   {
     stack_t ss;
 
-    stackbuf = (char *) xmalloc (SIGSTKSZ);
+    stackbuf = xmalloc (SIGSTKSZ);
 
     ss.ss_size = SIGSTKSZ;
-    ss.ss_sp = (void *) stackbuf;
+    ss.ss_sp = stackbuf;
     ss.ss_flags = 0;
     if (sigaltstack (&ss, NULL) < 0)
       {
-       free ((void *) stackbuf);
+       /* Oops - sigstack exists but doesn't work.  We can't install
+          the overflow detector, but should gracefully treat it as
+          though sigstack doesn't exist.  For example, this happens
+          when compiled with Linux 2.1 headers but run against Linux
+          2.0 kernel.  */
+       free (stackbuf);
+       if (errno == ENOSYS)
+         return;
        error (EXIT_FAILURE, errno, "sigaltstack");
       }
   }
@@ -381,13 +388,20 @@
 
   {
     struct sigstack ss;
-    stackbuf = (char *) xmalloc (2 * SIGSTKSZ);
+    stackbuf = xmalloc (2 * SIGSTKSZ);
 
     ss.ss_sp = stackbuf + SIGSTKSZ;
     ss.ss_onstack = 0;
     if (sigstack (&ss, NULL) < 0)
       {
-       free ((void *) stackbuf);
+       /* Oops - sigstack exists but doesn't work.  We can't install
+          the overflow detector, but should gracefully treat it as
+          though sigstack doesn't exist.  For example, this happens
+          when compiled with Linux 2.1 headers but run against Linux
+          2.0 kernel.  */
+       free (stackbuf);
+       if (errno == ENOSYS)
+         return;
        error (EXIT_FAILURE, errno, "sigstack");
       }
   }




reply via email to

[Prev in Thread] Current Thread [Next in Thread]