瀏覽代碼

Jeroen Dobbelaere writes:

Because variables are linked to fixed registers, there is a problem in :
     (*__errno_location())=(-_r0);

As __errno_location() uses r0 to return the address of the errno location,
the negated address will be assigned instead of the error code.

Attached patch will resolve this.
Eric Andersen 20 年之前
父節點
當前提交
3ae9a40e28
共有 1 個文件被更改,包括 2 次插入1 次删除
  1. 2 1
      libc/sysdeps/linux/arm/syscall.c

+ 2 - 1
libc/sysdeps/linux/arm/syscall.c

@@ -41,7 +41,8 @@ long syscall(long sysnum, long a, long b, long c, long d, long e, long f)
 	      "r"(_r6)
 	    : "memory");
     if(_r0 >=(unsigned long) -4095) {
-	(*__errno_location())=(-_r0);
+	long err = _r0;
+	(*__errno_location())=(-err);
 	_r0=(unsigned long) -1;
     }
     return (long) _r0;