소스 검색

the errno settings was fixed but the return value was still being clobbered ... fix that too

Mike Frysinger 19 년 전
부모
커밋
8ba79833fb
1개의 변경된 파일6개의 추가작업 그리고 5개의 파일을 삭제
  1. 6 5
      libc/sysdeps/linux/i386/__syscall_error.c

+ 6 - 5
libc/sysdeps/linux/i386/__syscall_error.c

@@ -36,10 +36,11 @@
  * We have to stash the errno from %eax in a local stack var because 
  * __set_errno will prob call a function thus clobbering %eax on us.
  */
-void attribute_hidden __syscall_error(void)
+int attribute_hidden __syscall_error(void)
 {
-	register int eax asm("%eax");
-	int stack = -eax;
-	__set_errno(stack);
-	eax = -1;
+	register int edx asm("%edx");
+	asm("mov %eax, %edx");
+	asm("negl %edx");
+	__set_errno(edx);
+	return -1;
 }