Thread (8 messages) flat view 8 messages, 5 authors, 2019-10-21

Re: [PATCH] bpftool: Try to read btf as raw data if elf read fails

From: Jiri Olsa <hidden>
Date: 2019-10-21 13:55:15
Also in: bpf

On Fri, Oct 18, 2019 at 08:04:44PM +0000, Yonghong Song wrote:

SNIP
quoted
quoted
+	FILE *f;
+
+	if (stat(file, &st))
+		return btf;
+
+	f = fopen(file, "rb");
+	if (!f)
+		return btf;
+
+	buf = malloc(st.st_size);
+	if (!buf)
+		goto err;
+
+	if ((size_t) st.st_size != fread(buf, 1, st.st_size, f))
+		goto err;
+
+	btf = btf__new(buf, st.st_size);
+
+err:
Non error case can also reach here. Let us change
label to a different name, e.g., "done"?
ok, will change

thanks,
jirka
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help