From: pierre-marc.fournier@polymtl.ca (Pierre-Marc Fournier)
Subject: [ltt-dev] [PATCH 1/2] Fix asprintf warning ignoring return value
Date: Thu, 09 Sep 2010 02:23:04 -0400 [thread overview]
Message-ID: <4C887D48.7060601@polymtl.ca> (raw)
In-Reply-To: <20100903185224.GD3324@Krystal>
On 09/03/2010 02:52 PM, Mathieu Desnoyers wrote:
> * David Goulet (david.goulet at polymtl.ca) wrote:
>> Signed-off-by: David Goulet<david.goulet at polymtl.ca>
>> ---
>> libust/tracectl.c | 63 ++++++++++++++++++++++++++++++++++++++++++--------
>> libustcmd/ustcmd.c | 41 +++++++++++++++++++++++++++-----
>> libustcomm/ustcomm.c | 24 ++++++++++++++++---
>> libustd/libustd.c | 37 ++++++++++++++++++++++++----
>> tests/hello/hello.c | 6 +++-
>> ustd/ustd.c | 12 ++++++++-
>> 6 files changed, 152 insertions(+), 31 deletions(-)
>>
>> diff --git a/libust/tracectl.c b/libust/tracectl.c
>> index ac551d5..1bb841f 100644
>> --- a/libust/tracectl.c
>> +++ b/libust/tracectl.c
>> @@ -156,7 +156,11 @@ static void inform_consumer_daemon(const char *trace_name)
>> /* iterate on all cpus */
>> for(j=0; j<trace->channels[i].n_cpus; j++) {
>> char *buf;
>> - asprintf(&buf, "%s_%d", trace->channels[i].channel_name, j);
>> + if(asprintf(&buf, "%s_%d", trace->channels[i].channel_name, j) == -1) {
>
> please standardize on the kernel coding style:
>
> if ()
> for ()
> switch ()
>
> but function() and macroname().
>
> Also, please use a if (asprintf(...)< 0) test. I know the manpage
> states that -1 is explicitely returned, but it's very typical for all
> negative values to be more explicit error value variants. So let's make
> these tests as similar as possible.
>
No. It's typical in the linux kernel, but not in unix userspace and not
in ust internal apis.
pmf
prev parent reply other threads:[~2010-09-09 6:23 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-09-03 16:37 David Goulet
2010-09-03 16:37 ` [ltt-dev] [PATCH 2/2] Fix retval value assignment on error David Goulet
2010-09-03 18:47 ` Mathieu Desnoyers
2010-09-06 14:05 ` Nils Carlson
2010-09-03 18:52 ` [ltt-dev] [PATCH 1/2] Fix asprintf warning ignoring return value Mathieu Desnoyers
2010-09-03 19:19 ` David Goulet
2010-09-03 20:37 ` Mathieu Desnoyers
2010-09-09 6:23 ` Pierre-Marc Fournier [this message]
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=4C887D48.7060601@polymtl.ca \
--to=pierre-marc.fournier@polymtl.ca \
/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