]> granicus.if.org Git - php/commitdiff
Make the sigsetjmp change more robust. On systems that don't have
authorRasmus Lerdorf <rasmus@php.net>
Tue, 18 Mar 2008 21:14:28 +0000 (21:14 +0000)
committerRasmus Lerdorf <rasmus@php.net>
Tue, 18 Mar 2008 21:14:28 +0000 (21:14 +0000)
sigsetjmp use setjmp.  Windows is of course weird in that it seems to
have sigsetjmp but not sigjmp_buf (??) so force it to use setjmp in
config.w32.h.in

Zend/Zend.m4
Zend/zend.c
Zend/zend.h
Zend/zend_globals.h
win32/build/config.w32.h.in

index 61150fab0005c14e033d1497ed81273938470320..bbb3411a4a8cda14e2ee764598bb045084ffba18 100644 (file)
@@ -109,7 +109,7 @@ dnl Checks for library functions.
 AC_FUNC_VPRINTF
 AC_FUNC_MEMCMP
 AC_FUNC_ALLOCA
-AC_CHECK_FUNCS(memcpy strdup getpid kill strtod strtol finite fpclass)
+AC_CHECK_FUNCS(memcpy strdup getpid kill strtod strtol finite fpclass sigsetjmp)
 AC_ZEND_BROKEN_SPRINTF
 
 AC_CHECK_FUNCS(finite isfinite isinf isnan)
index a7bd8a773ddcd6dd530784b9528ec87edfc8d0b6..71b39fcb749e4bd0686c5c1f59753d728faa7dae 100644 (file)
@@ -794,7 +794,7 @@ ZEND_API void _zend_bailout(char *filename, uint lineno) /* {{{ */
        CG(unclean_shutdown) = 1;
        CG(in_compilation) = EG(in_execution) = 0;
        EG(current_execute_data) = NULL;
-       siglongjmp(*EG(bailout), FAILURE);
+       LONGJMP(*EG(bailout), FAILURE);
 }
 /* }}} */
 END_EXTERN_C()
index 2d7a21e1dc83f33d175807ef0f5538f7a9e3b95c..5249f8c078d61c768e37d524e9eb94dae5b3e800 100644 (file)
@@ -520,13 +520,23 @@ END_EXTERN_C()
 
 #define zend_bailout()         _zend_bailout(__FILE__, __LINE__)
 
+#ifdef HAVE_SIGSETJMP
+#      define SETJMP(a) sigsetjmp(a, 0)
+#      define LONGJMP(a,b) siglongjmp(a, b)
+#      define JMP_BUF sigjmp_buf
+#else
+#      define SETJMP(a) setjmp(a)
+#      define LONGJMP(a,b) longjmp(a, b)
+#      define JMP_BUF jmp_buf
+#endif
+
 #define zend_try                                                                                               \
        {                                                                                                                       \
-               sigjmp_buf *__orig_bailout = EG(bailout);                                       \
-               sigjmp_buf __bailout;                                                                           \
+               JMP_BUF *__orig_bailout = EG(bailout);                                  \
+               JMP_BUF __bailout;                                                                              \
                                                                                                                                \
                EG(bailout) = &__bailout;                                                               \
-               if (sigsetjmp(__bailout, 0)==0) {
+               if (SETJMP(__bailout)==0) {
 #define zend_catch                                                                                             \
                } else {                                                                                                \
                        EG(bailout) = __orig_bailout;
index 3e3e34a1d6a859129676526182cc6832b3712f7f..66997b3ae03be05d1eb72c43a7ec2d3f462ed835 100644 (file)
@@ -161,7 +161,7 @@ struct _zend_executor_globals {
 
        HashTable included_files;       /* files already included */
 
-       sigjmp_buf *bailout;
+       JMP_BUF *bailout;
 
        int error_reporting;
        int orig_error_reporting;
index 442850a3e5562d0b654e5e54a021d99a367b01d7..5a3311856b969d8a0577dbb4d5f7e213de966102 100644 (file)
@@ -54,6 +54,7 @@
 #define NEED_ISBLANK 1
 #define DISCARD_PATH 0
 #undef HAVE_SETITIMER
+#undef HAVE_SIGSETJMP
 #undef HAVE_IODBC
 #define HAVE_LIBDL 1
 #define HAVE_GETTIMEOFDAY 1