OSDN Git Service

selftests/bpf: Set errno when urand_spawn() fails
authorIlya Leoshkevich <iii@linux.ibm.com>
Sat, 28 Jan 2023 00:06:26 +0000 (01:06 +0100)
committerAlexei Starovoitov <ast@kernel.org>
Sat, 28 Jan 2023 20:30:08 +0000 (12:30 -0800)
The result of urand_spawn() is checked with ASSERT_OK_PTR, which treats
NULL as success if errno == 0.

Signed-off-by: Ilya Leoshkevich <iii@linux.ibm.com>
Link: https://lore.kernel.org/r/20230128000650.1516334-8-iii@linux.ibm.com
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
tools/testing/selftests/bpf/prog_tests/usdt.c

index 9ad9da0..56ed1eb 100644 (file)
@@ -314,6 +314,7 @@ static FILE *urand_spawn(int *pid)
 
        if (fscanf(f, "%d", pid) != 1) {
                pclose(f);
+               errno = EINVAL;
                return NULL;
        }