set_robust_list: Add error check
set_robust_list is not supported by McKernel. Change-Id: I1f679e2e4df24139cceb1f2294bc072cb7956002 Refs: 1399
This commit is contained in:
committed by
Masamichi Takagi
parent
ebc91cea0e
commit
b44b11ace7
36
test/issues/1399/C1399T01.c
Normal file
36
test/issues/1399/C1399T01.c
Normal file
@@ -0,0 +1,36 @@
|
||||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
#include <linux/futex.h>
|
||||
#include <syscall.h>
|
||||
#include <errno.h>
|
||||
|
||||
int main(int argc, void *argv[])
|
||||
{
|
||||
struct robust_list_head rlh;
|
||||
size_t len = sizeof(struct robust_list_head);
|
||||
int rc = 0, ret = 0;
|
||||
|
||||
errno = 0;
|
||||
rc = syscall(__NR_set_robust_list, &rlh, len + 1);
|
||||
if (rc == -1 && errno == EINVAL) {
|
||||
printf("[OK] invalid len (1 greater than correct): EINVAL\n");
|
||||
} else {
|
||||
printf("[NG] invalid len (1 greater than correct): Succeed\n");
|
||||
ret = -1;
|
||||
goto out;
|
||||
}
|
||||
|
||||
errno = 0;
|
||||
rc = syscall(__NR_set_robust_list, &rlh, len - 1);
|
||||
if (rc == -1 && errno == EINVAL) {
|
||||
printf("[OK] invalid len (1 less than correct): EINVAL\n");
|
||||
} else {
|
||||
printf("[NG] invalid len (1 less than correct): Succeed\n");
|
||||
ret = -1;
|
||||
goto out;
|
||||
}
|
||||
|
||||
out:
|
||||
return ret;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user