From: Arnaldo Carvalho de Melo <acme@kernel.org>
To: Sihyeon Jang <uneedsihyeon@gmail.com>
Cc: linux-kernel@vger.kernel.org, Jiri Olsa <jolsa@kernel.org>,
Namhyung Kim <namhyung@kernel.org>
Subject: Re: [PATCH] perf util config : Modify size factor of snprintf
Date: Thu, 6 Dec 2018 14:09:47 -0300 [thread overview]
Message-ID: <20181206170947.GL19069@kernel.org> (raw)
In-Reply-To: <20181201154603.10093-1-uneedsihyeon@gmail.com>
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
next prev parent reply other threads:[~2018-12-06 17:09 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-12-01 15:46 [PATCH] perf util config : Modify size factor of snprintf Sihyeon Jang
2018-12-06 17:09 ` Arnaldo Carvalho de Melo [this message]
2018-12-14 20:59 ` [tip:perf/core] perf config: " tip-bot for Sihyeon Jang
2018-12-18 14:26 ` tip-bot for Sihyeon Jang
-- strict thread matches above, loose matches on Subject: below --
2018-12-01 15:43 [PATCH] perf util config : " Sihyeon Jang
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20181206170947.GL19069@kernel.org \
--to=acme@kernel.org \
--cc=jolsa@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=namhyung@kernel.org \
--cc=uneedsihyeon@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox