Skip to content

Commit

Permalink
selftests/bpf: Fix fclose/pclose mismatch in test_progs
Browse files Browse the repository at this point in the history
Make sure to use pclose() to properly close the pipe opened by popen().

Fixes: 81f77fd ("bpf: add selftest for stackmap with BPF_F_STACK_BUILD_ID")
Signed-off-by: Andrea Righi <andrea.righi@canonical.com>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Reviewed-by: Shuah Khan <skhan@linuxfoundation.org>
Acked-by: Martin KaFai Lau <kafai@fb.com>
Link: https://lore.kernel.org/bpf/20211026143409.42666-1-andrea.righi@canonical.com
  • Loading branch information
Andrea Righi authored and Daniel Borkmann committed Oct 29, 2021
1 parent b9989b5 commit f48ad69
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions tools/testing/selftests/bpf/test_progs.c
Original file line number Diff line number Diff line change
Expand Up @@ -382,7 +382,7 @@ int extract_build_id(char *build_id, size_t size)

if (getline(&line, &len, fp) == -1)
goto err;
fclose(fp);
pclose(fp);

if (len > size)
len = size;
Expand All @@ -391,7 +391,7 @@ int extract_build_id(char *build_id, size_t size)
free(line);
return 0;
err:
fclose(fp);
pclose(fp);
return -1;
}

Expand Down

0 comments on commit f48ad69

Please sign in to comment.