lkml.org 
[lkml]   [2018]   [Dec]   [6]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] perf util config : Modify size factor of snprintf
Em Sun, Dec 02, 2018 at 12:46:03AM +0900, Sihyeon Jang escreveu:
> 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)

Thanks, applied.

- Arnaldo

> Cc: Jiri Olsa <jolsa@kernel.org>
> Cc: Namhyung Kim <namhyung@kernel.org>
> Signed-off-by: Sihyeon Jang <uneedsihyeon@gmail.com>
> ---
> tools/perf/util/config.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/tools/perf/util/config.c b/tools/perf/util/config.c
> index 5ac157056cdf..bce980fa9f41 100644
> --- a/tools/perf/util/config.c
> +++ b/tools/perf/util/config.c
> @@ -811,14 +811,14 @@ int config_error_nonbool(const char *var)
> void set_buildid_dir(const char *dir)
> {
> if (dir)
> - scnprintf(buildid_dir, MAXPATHLEN-1, "%s", dir);
> + scnprintf(buildid_dir, MAXPATHLEN, "%s", dir);
>
> /* default to $HOME/.debug */
> if (buildid_dir[0] == '\0') {
> char *home = getenv("HOME");
>
> if (home) {
> - snprintf(buildid_dir, MAXPATHLEN-1, "%s/%s",
> + snprintf(buildid_dir, MAXPATHLEN, "%s/%s",
> home, DEBUG_CACHE_DIR);
> } else {
> strncpy(buildid_dir, DEBUG_CACHE_DIR, MAXPATHLEN-1);
> --
> 2.17.1

--

- Arnaldo

\
 
 \ /
  Last update: 2018-12-06 18:10    [W:0.039 / U:2.756 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site