Linux bluetooth development
 help / color / mirror / Atom feed
From: Ravi kumar Veeramally <ravikumar.veeramally@linux.intel.com>
To: linux-bluetooth@vger.kernel.org, johan.hedberg@gmail.com
Subject: Re: [PATCH_v2 1/4] android/pan: Register Network Access Point
Date: Tue, 07 Jan 2014 14:04:19 +0200	[thread overview]
Message-ID: <52CBED43.3030505@linux.intel.com> (raw)
In-Reply-To: <20140107115539.GA2107@x220.p-661hnu-f1>

Hi Johan,

On 01/07/2014 01:55 PM, Johan Hedberg wrote:
> Hi Ravi,
>
> On Tue, Jan 07, 2014, Ravi kumar Veeramally wrote:
>> +static int set_forward_delay(void)
>> +{
>> +	FILE *f;
>> +	char *path;
>> +
>> +	path = g_strdup_printf("/sys/class/net/%s/bridge/forward_delay",
>> +								BNEP_BRIDGE);
>> +	if (!path)
>> +		return -ENOMEM;
>> +
>> +	f = fopen(path, "r+");
>> +	g_free(path);
>> +	if (!f)
>> +		return -errno;
> The above is not safe since g_free() might modify the value of errno.
>
> In general, we're not really in the habit of using the f* variants of
> file access functions. Could you convert the above to use a stack
> variable for path (there's a PATH_MAX variable you can use for its
> size) together with sprintf and use open + write instead of fopen +
> fprintf?
   Ok, I will change it.
>> +static int nap_create_bridge(void)
>> +{
>> +	int sk, err;
>> +
>> +	DBG(" %s", BNEP_BRIDGE);
> Why the extra space before %s?
  I will remove it.
>
>> +	if (ioctl(sk, SIOCBRADDBR, BNEP_BRIDGE) == -1) {
> We usually check for this kind of errors with < 0 instead of == -1.
   Ok.
>
>> +	DBG(" %s", BNEP_BRIDGE);
> Same thing here with the seemingly unnecessary space.
   Ok, I will remove it.

  Regards,
  Ravi.

  reply	other threads:[~2014-01-07 12:04 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-01-07 11:18 [PATCH_v2 0/4] Add support for NAP role Ravi kumar Veeramally
2014-01-07 11:18 ` [PATCH_v2 1/4] android/pan: Register Network Access Point Ravi kumar Veeramally
2014-01-07 11:55   ` Johan Hedberg
2014-01-07 12:04     ` Ravi kumar Veeramally [this message]
2014-01-07 11:18 ` [PATCH_v2 2/4] android/pan: Listen for incoming connections and accept in NAP role Ravi kumar Veeramally
2014-01-07 11:18 ` [PATCH_v2 3/4] android/pan: Implement PAN enable HAL api at daemon side Ravi kumar Veeramally
2014-01-07 11:18 ` [PATCH_v2 4/4] android/pan: Remove connected PAN devices on profile unregister call Ravi kumar Veeramally

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=52CBED43.3030505@linux.intel.com \
    --to=ravikumar.veeramally@linux.intel.com \
    --cc=johan.hedberg@gmail.com \
    --cc=linux-bluetooth@vger.kernel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox