about summary refs log tree commit diff
path: root/sysdeps/unix
diff options
context:
space:
mode:
authorAndreas Jaeger <aj@suse.de>2004-06-05 07:54:40 +0000
committerAndreas Jaeger <aj@suse.de>2004-06-05 07:54:40 +0000
commitc2df18a9709c8d726dece41d5b1fee3bcdd0f2be (patch)
treee6238ec58452027a530168912ce13a89ce3fd52f /sysdeps/unix
parent29762ba617ffcb44c583226fd19681e246fd074e (diff)
downloadglibc-c2df18a9709c8d726dece41d5b1fee3bcdd0f2be.tar.gz
glibc-c2df18a9709c8d726dece41d5b1fee3bcdd0f2be.tar.xz
glibc-c2df18a9709c8d726dece41d5b1fee3bcdd0f2be.zip
(__makecontext): Handle more than 6 args correctly. Based on a patch by Masahide Washizawa.
Diffstat (limited to 'sysdeps/unix')
-rw-r--r--sysdeps/unix/sysv/linux/x86_64/makecontext.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/sysdeps/unix/sysv/linux/x86_64/makecontext.c b/sysdeps/unix/sysv/linux/x86_64/makecontext.c
index b1129943ab..c763556b93 100644
--- a/sysdeps/unix/sysv/linux/x86_64/makecontext.c
+++ b/sysdeps/unix/sysv/linux/x86_64/makecontext.c
@@ -58,11 +58,11 @@ __makecontext (ucontext_t *ucp, void (*func) (void), int argc, ...)
 
   /* Generate room on stack for parameter if needed and uc_link.  */
   sp = (long *) ((long) ucp->uc_stack.ss_sp + ucp->uc_stack.ss_size);
-  sp -= (argc > 6 ? argc : 0) + 1;
+  sp -= (argc > 6 ? argc - 6 : 0) + 1;
   /* Align stack and make space for trampoline address.  */
   sp = (long *) ((((long) sp) & -16L) - 8);
 
-  idx_uc_link = (argc > 6 ? argc : 0) + 1;
+  idx_uc_link = (argc > 6 ? argc - 6 : 0) + 1;
 
   /* Setup context ucp.  */
   /* Address to jump to.  */
@@ -100,7 +100,7 @@ __makecontext (ucontext_t *ucp, void (*func) (void), int argc, ...)
 	break;
       default:
 	/* Put value on stack.  */
-	sp[8 + (i - 5)] = va_arg (ap, int);
+	sp[(i - 5)] = va_arg (ap, int);
 	break;
       }
   va_end (ap);