Skip to content

Commit 75c375c

Browse files
sihyeonnacmel
authored andcommitted
perf config: Modify size factor of snprintf
According to definition of snprintf, it gets size factor including null('\0') byte. So '-1' is not neccessary. Also it will be helpful unfied style with other cases. (eg. builtin-script.c) Signed-off-by: Sihyeon Jang <[email protected]> Cc: Jiri Olsa <[email protected]> Cc: Namhyung Kim <[email protected]> Link: http://lkml.kernel.org/r/[email protected] Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
1 parent c8dd6ee commit 75c375c

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

tools/perf/util/config.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -815,14 +815,14 @@ int config_error_nonbool(const char *var)
815815
void set_buildid_dir(const char *dir)
816816
{
817817
if (dir)
818-
scnprintf(buildid_dir, MAXPATHLEN-1, "%s", dir);
818+
scnprintf(buildid_dir, MAXPATHLEN, "%s", dir);
819819

820820
/* default to $HOME/.debug */
821821
if (buildid_dir[0] == '\0') {
822822
char *home = getenv("HOME");
823823

824824
if (home) {
825-
snprintf(buildid_dir, MAXPATHLEN-1, "%s/%s",
825+
snprintf(buildid_dir, MAXPATHLEN, "%s/%s",
826826
home, DEBUG_CACHE_DIR);
827827
} else {
828828
strncpy(buildid_dir, DEBUG_CACHE_DIR, MAXPATHLEN-1);

0 commit comments

Comments
 (0)