Commit acd3b776 authored by Changbin Du's avatar Changbin Du Committed by Andrii Nakryiko
Browse files

libbpf: Return -ENODATA for missing btf section



As discussed before, return -ENODATA (No data available) would be more
meaningful than ENOENT (No such file or directory).

Suggested-by: default avatarLeo Yan <leo.yan@linaro.org>
Signed-off-by: default avatarChangbin Du <changbin.du@gmail.com>
Signed-off-by: default avatarAndrii Nakryiko <andrii@kernel.org>
Link: https://lore.kernel.org/bpf/20221231151436.6541-1-changbin.du@gmail.com
parent 00883922
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -1004,7 +1004,7 @@ static struct btf *btf_parse_elf(const char *path, struct btf *base_btf,

	if (!btf_data) {
		pr_warn("failed to find '%s' ELF section in %s\n", BTF_ELF_SEC, path);
		err = -ENOENT;
		err = -ENODATA;
		goto done;
	}
	btf = btf_new(btf_data->d_buf, btf_data->d_size, base_btf);