Commit f48ad690 authored by Andrea Righi's avatar Andrea Righi Committed by Daniel Borkmann

selftests/bpf: Fix fclose/pclose mismatch in test_progs

Make sure to use pclose() to properly close the pipe opened by popen().

Fixes: 81f77fd0 ("bpf: add selftest for stackmap with BPF_F_STACK_BUILD_ID")
Signed-off-by: default avatarAndrea Righi <andrea.righi@canonical.com>
Signed-off-by: default avatarDaniel Borkmann <daniel@iogearbox.net>
Reviewed-by: default avatarShuah Khan <skhan@linuxfoundation.org>
Acked-by: default avatarMartin KaFai Lau <kafai@fb.com>
Link: https://lore.kernel.org/bpf/20211026143409.42666-1-andrea.righi@canonical.com
parent b9989b59
...@@ -382,7 +382,7 @@ int extract_build_id(char *build_id, size_t size) ...@@ -382,7 +382,7 @@ int extract_build_id(char *build_id, size_t size)
if (getline(&line, &len, fp) == -1) if (getline(&line, &len, fp) == -1)
goto err; goto err;
fclose(fp); pclose(fp);
if (len > size) if (len > size)
len = size; len = size;
...@@ -391,7 +391,7 @@ int extract_build_id(char *build_id, size_t size) ...@@ -391,7 +391,7 @@ int extract_build_id(char *build_id, size_t size)
free(line); free(line);
return 0; return 0;
err: err:
fclose(fp); pclose(fp);
return -1; return -1;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment