92b3d6365d
GitOrigin-RevId: 412b9917cea092f3d39f9cd5dead4effd5bc4053
15 lines
475 B
Diff
15 lines
475 B
Diff
Strip path to the binary from prints.
|
|
|
|
I see no sense in including the full path in outputs like bpftool --version
|
|
Especially as argv[0] may not include it, based on calling via $PATH or not.
|
|
--- a/tools/bpf/bpftool/main.c
|
|
+++ b/tools/bpf/bpftool/main.c
|
|
@@ -443 +443,7 @@
|
|
- bin_name = argv[0];
|
|
+ /* Strip the path if any. */
|
|
+ const char *bin_name_slash = strrchr(argv[0], '/');
|
|
+ if (bin_name_slash) {
|
|
+ bin_name = bin_name_slash + 1;
|
|
+ } else {
|
|
+ bin_name = argv[0];
|
|
+ }
|