[PATCH v1 3/3] perf ui scripts: Switch FILENAME_MAX to NAME_MAX

From: Ian Rogers
Date: Wed Jul 16 2025 - 16:15:46 EST


FILENAME_MAX is the same as PATH_MAX (4kb) in glibc rather than
NAME_MAX's 255. Switch to using NAME_MAX and ensure the '\0' is
accounted for in the path's buffer size.

Signed-off-by: Ian Rogers <irogers@xxxxxxxxxx>
---
tools/perf/ui/browsers/scripts.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/perf/ui/browsers/scripts.c b/tools/perf/ui/browsers/scripts.c
index 2d04ece833aa..1e8c2c2f952d 100644
--- a/tools/perf/ui/browsers/scripts.c
+++ b/tools/perf/ui/browsers/scripts.c
@@ -94,7 +94,7 @@ static int check_ev_match(int dir_fd, const char *scriptname, struct perf_sessio
FILE *fp;

{
- char filename[FILENAME_MAX + 5];
+ char filename[NAME_MAX + 5];
int fd;

scnprintf(filename, sizeof(filename), "bin/%s-record", scriptname);
--
2.50.0.727.gbf7dc18ff4-goog