[syslinux] [PATCH] setjmp.S: longjmp() must not cause setjmp() to return zero

Matt Fleming matt at console-pimps.org
Thu Apr 14 12:17:37 PDT 2011


From: Matt Fleming <matt.fleming at linux.intel.com>

POSIX specifies that if 0 is passed as the 'val' argument to
longjmp(), setjmp() must return 1. setjmp() must NOT return 0 if it's
returning because of a call to longjmp().

Signed-off-by: Matt Fleming <matt.fleming at linux.intel.com>
---
 com32/lib/setjmp.S |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/com32/lib/setjmp.S b/com32/lib/setjmp.S
index 658df48..344c62a 100644
--- a/com32/lib/setjmp.S
+++ b/com32/lib/setjmp.S
@@ -53,6 +53,10 @@ longjmp:
 	movl 4(%esp),%edx		# jmp_ptr address
 	movl 8(%esp),%eax		# Return value
 #endif
+	cmpl $0,%eax
+	jnz 1f
+	inc %eax
+1:
 	movl (%edx),%ebx
 	movl 4(%edx),%esp
 	movl 8(%edx),%ebp
-- 
1.7.4.2




More information about the Syslinux mailing list