Skip to contentSkip to conversation

bpftool: Fix errno variable usage

PATCH Applied Benjamin Poirier 5 participants 5 messages Apr 11, 2019 – Apr 26, 2019

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 bpftool: Fix errno variable usage

The test meant to use the saved value of errno. Given the current code, it makes no practical difference however.

Fixes bf598a8f0f77 ("bpftool: Improve handling of ENOENT on map dumps")
---
 tools/bpf/bpftool/map.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tools/bpf/bpftool/map.c +1 -1
index e0c650d91784..05b029b934a6 100644
@@ -720,7 +720,7 @@ static int dump_map_elem(int fd, void *key, void *value,
 		jsonw_string_field(json_wtr, "error", strerror(lookup_errno));
 		jsonw_end_object(json_wtr);
 	} else {
-		if (errno == ENOENT)
+		if (lookup_errno == ENOENT)
 			print_entry_plain(map_info, key, NULL);
 		else
 			print_entry_error(map_info, key,
Signature · 1 line
2.21.0
Reviewed-by on v1 1/1
#1 lore raw

2019-04-11 17:03 UTC+0900 ~ Benjamin Poirier <[email protected]>

Quoted 15 lines

The test meant to use the saved value of errno. Given the current code, it makes no practical difference however.

Fixes bf598a8f0f77 ("bpftool: Improve handling of ENOENT on map dumps")
---
 tools/bpf/bpftool/map.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tools/bpf/bpftool/map.c +0 -0
index e0c650d91784..05b029b934a6 100644

tools/bpf/bpftool/map.c static int dump_map_elem(int fd, void *key, void *value, · line 726

Quoted 8 lines
tools/bpf/bpftool/map.c +1 -1
@@ -720,7 +720,7 @@ static int dump_map_elem(int fd, void *key, void *value,
 		jsonw_string_field(json_wtr, "error", strerror(lookup_errno));
 		jsonw_end_object(json_wtr);
 	} else {
-		if (errno == ENOENT)
+		if (lookup_errno == ENOENT)
 			print_entry_plain(map_info, key, NULL);
 		else
 			print_entry_error(map_info, key,
Acked-by
#2 lore raw
Quoted 7 lines · Quentin Monnet

2019-04-11 17:03 UTC+0900 ~ Benjamin Poirier <[email protected]>

Quoted 5 lines

The test meant to use the saved value of errno. Given the current code, it makes no practical difference however.

Fixes bf598a8f0f77 ("bpftool: Improve handling of ENOENT on map dumps")
Quoted 21 lines
Quoted 10 lines
---
 tools/bpf/bpftool/map.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tools/bpf/bpftool/map.c +0 -0
index e0c650d91784..05b029b934a6 100644

tools/bpf/bpftool/map.c static int dump_map_elem(int fd, void *key, void *value, · line 726

Quoted 8 lines
tools/bpf/bpftool/map.c +1 -1
@@ -720,7 +720,7 @@ static int dump_map_elem(int fd, void *key, void *value,
              jsonw_string_field(json_wtr, "error", strerror(lookup_errno));
              jsonw_end_object(json_wtr);
      } else {
-             if (errno == ENOENT)
+             if (lookup_errno == ENOENT)
                      print_entry_plain(map_info, key, NULL);
              else
                      print_entry_error(map_info, key,
#4 lore raw
Quoted 9 lines · Daniel Borkmann
Quoted 5 lines · Benjamin Poirier

The test meant to use the saved value of errno. Given the current code, it makes no practical difference however.

Fixes bf598a8f0f77 ("bpftool: Improve handling of ENOENT on map dumps")

Applied, thanks!

I removed this commit from bpf tree and re-applied to bpf-next. Benjamin, next time please target such cleanups consistently to bpf-next tree only to avoid merge conflicts.

Thanks