瀏覽代碼

if function or stack are NULL, make sure errno is set to EINVAL

Mike Frysinger 18 年之前
父節點
當前提交
9bf0b8bb7e
共有 1 個文件被更改,包括 5 次插入0 次删除
  1. 5 0
      libc/sysdeps/linux/bfin/clone.c

+ 5 - 0
libc/sysdeps/linux/bfin/clone.c

@@ -7,6 +7,7 @@
  */
 
 #include <sched.h>
+#include <errno.h>
 #include <sys/syscall.h>
 
 int
@@ -57,6 +58,10 @@ clone (int (*fn)(void *arg), void *child_stack, int flags, void *arg, ...)
 			: "i" (__NR_clone), "a" (child_stack), "a" (flags), "a" (arg), "a" (fn), "i" (__NR_exit)
 			: "CC", "R0", "R1", "P0");
 #endif
+
+	} else {
+		__set_errno(EINVAL);
 	}
+
 	return rval;
 }