at 23.05-pre 15 lines 475 B view raw
1Strip path to the binary from prints. 2 3I see no sense in including the full path in outputs like bpftool --version 4Especially as argv[0] may not include it, based on calling via $PATH or not. 5--- a/tools/bpf/bpftool/main.c 6+++ b/tools/bpf/bpftool/main.c 7@@ -443 +443,7 @@ 8- bin_name = argv[0]; 9+ /* Strip the path if any. */ 10+ const char *bin_name_slash = strrchr(argv[0], '/'); 11+ if (bin_name_slash) { 12+ bin_name = bin_name_slash + 1; 13+ } else { 14+ bin_name = argv[0]; 15+ }