All of lore.kernel.org
 help / color / mirror / Atom feed
From: Arnaldo Carvalho de Melo <acme@kernel.org>
To: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>,
	Adrian Hunter <adrian.hunter@intel.com>,
	linux-kernel@vger.kernel.org, Ingo Molnar <mingo@redhat.com>,
	Paul Mackerras <paulus@samba.org>, Jiri Olsa <jolsa@kernel.org>,
	Namhyung Kim <namhyung@kernel.org>, Borislav Petkov <bp@suse.de>,
	Hemant Kumar <hemant@linux.vnet.ibm.com>
Subject: Re: [perf/core PATCH v2 2/4] perf buildid-cache: Consolidate .build-id cache path generators
Date: Wed, 11 Feb 2015 11:46:05 -0300	[thread overview]
Message-ID: <20150211144605.GG24251@kernel.org> (raw)
In-Reply-To: <20150210091853.19264.58513.stgit@localhost.localdomain>

Em Tue, Feb 10, 2015 at 06:18:53PM +0900, Masami Hiramatsu escreveu:
> +static int asnprintf(char **strp, size_t size, const char *fmt, ...)
> +{
> +	va_list ap;
> +	int ret;
> +	if (!strp)
> +		return -EINVAL;
> +	va_start(ap, fmt);
> +	if (*strp)
> +		ret = vsnprintf(*strp, size, fmt, ap);
> +	else
> +		ret = vasprintf(strp, fmt, ap);
> +	va_end(ap);
> +	return ret;
> +}
> +static char *build_id__filename(const char *sbuild_id, char *bf, size_t size)
> +{
> +	char *tmp = bf;
> +	int ret = asnprintf(&bf, size, "%s/.build-id/%.2s/%s", buildid_dir,
> +			    sbuild_id, sbuild_id + 2);
> +	if (ret < 0 || (tmp && size < (unsigned int)ret))
> +		return NULL;

This is a good thing, i.e. checking if the formatting truncated
something, i.e. vsnprintf honours 'size' but may return more than that,
but next time try to get it into a separate patch :-)

Anyway, after scratching my head with this extra thing/re-reading the
vsnprintf man page, I'm applying this patch, thanks.

- Arnaldo

  reply	other threads:[~2015-02-11 14:46 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-02-10  9:18 [perf/core PATCH v2 0/4] perf-buildid-cache: Cleanup, enhance --update and add --remove-all Masami Hiramatsu
2015-02-10  9:18 ` [perf/core PATCH v2 1/4] perf-buildid-cache: Remove unneeded debugdir parameters Masami Hiramatsu
2015-02-18 18:29   ` [tip:perf/core] perf buildid-cache: " tip-bot for Masami Hiramatsu
2015-02-10  9:18 ` [perf/core PATCH v2 2/4] perf buildid-cache: Consolidate .build-id cache path generators Masami Hiramatsu
2015-02-11 14:46   ` Arnaldo Carvalho de Melo [this message]
2015-02-18 18:30   ` [tip:perf/core] " tip-bot for Masami Hiramatsu
2015-02-10  9:18 ` [perf/core PATCH v2 3/4] perf buildid-cache: Add new buildid cache if update target is not cached Masami Hiramatsu
2015-02-11 14:49   ` Arnaldo Carvalho de Melo
2015-02-11 14:57     ` Arnaldo Carvalho de Melo
2015-02-12  6:36       ` Masami Hiramatsu
2015-02-12 14:11         ` Arnaldo Carvalho de Melo
2015-02-10  9:18 ` [perf/core PATCH v2 4/4] perf buildid-cache: Add --remove-all FILE to remove all caches of FILE Masami Hiramatsu
2015-02-11 15:00   ` Arnaldo Carvalho de Melo
2015-02-12  6:13     ` Masami Hiramatsu
2015-02-12 14:12       ` Arnaldo Carvalho de Melo
2015-02-10 14:09 ` [perf/core PATCH v2 0/4] perf-buildid-cache: Cleanup, enhance --update and add --remove-all Namhyung Kim

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=20150211144605.GG24251@kernel.org \
    --to=acme@kernel.org \
    --cc=a.p.zijlstra@chello.nl \
    --cc=adrian.hunter@intel.com \
    --cc=bp@suse.de \
    --cc=hemant@linux.vnet.ibm.com \
    --cc=jolsa@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=masami.hiramatsu.pt@hitachi.com \
    --cc=mingo@redhat.com \
    --cc=namhyung@kernel.org \
    --cc=paulus@samba.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.