Open Source Telephony
 help / color / mirror / Atom feed
From: Denis Kenzior <denkenz@gmail.com>
To: ofono@ofono.org
Subject: Re: [PATCH 2/3] Use %m instead of strerror() in syslog messages
Date: Fri, 26 Nov 2010 15:12:09 -0600	[thread overview]
Message-ID: <4CF022A9.2070104@gmail.com> (raw)
In-Reply-To: <1290682265-11373-2-git-send-email-remi.denis-courmont@nokia.com>

[-- Attachment #1: Type: text/plain, Size: 1430 bytes --]

On 11/25/2010 04:51 AM, Rémi Denis-Courmont wrote:
> strerror() is not thread-safe, nor in the glibc implementation,
> nor in the POSIX specification. In my experience, it will infrequently
> crash when another thread uses locale data in any way, including
> string formatting and such...
> 
> Since the Huawei driver uses thread, we might as well avoid strerror().
> ---
>  drivers/isimodem/sim.c |    3 ++-
>  plugins/hfp.c          |    4 ++--
>  plugins/isigen.c       |   13 ++++++++-----
>  plugins/n900.c         |   14 +++++++-------
>  plugins/nokia-gpio.c   |   29 +++++++++++++++++------------
>  5 files changed, 36 insertions(+), 27 deletions(-)
> 

Since we do not use threads, do you still want this patch?  If you do,
can you please break this up into two patches, one for drivers/isimodem
and one for plugins?  We prefer patches to be split by directory.

<snip>

> @@ -765,7 +767,10 @@ int gpio_probe(GIsiModem *idx, unsigned addr, gpio_finished_cb_t cb, void *data)
>  	if (addr) {
>  		error = g_pn_netlink_set_address(idx, addr);
>  		if (error && error != -EEXIST)
> -			DBG("g_pn_netlink_set_address: %s", strerror(-error));
> +		{
> +			errno = -error;
> +			DBG("g_pn_netlink_set_address: %m");
> +		}
>  	}
>  
>  	return 0;

You might also want to fix the style violation above, the opening brace
should be on the same line as the if statement.

Regards,
-Denis

  parent reply	other threads:[~2010-11-26 21:12 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-11-25 10:51 [PATCH 1/3] Remove stray newlines in DBG and ofono log messages =?unknown-8bit?q?R=C3=A9mi?= Denis-Courmont
2010-11-25 10:51 ` [PATCH 2/3] Use %m instead of strerror() in syslog messages =?unknown-8bit?q?R=C3=A9mi?= Denis-Courmont
2010-11-25 12:12   ` Marcel Holtmann
2010-11-25 13:28     ` =?unknown-8bit?q?R=C3=A9mi?= Denis-Courmont
2010-11-26 21:12   ` Denis Kenzior [this message]
2010-11-29  8:11     ` =?unknown-8bit?q?R=C3=A9mi?= Denis-Courmont
2010-11-29  9:28       ` Marcel Holtmann
2010-11-25 10:51 ` [PATCH 3/3] gisi: use strerror_r() instead of strerror() =?unknown-8bit?q?R=C3=A9mi?= Denis-Courmont
2010-11-26 21:07   ` Denis Kenzior
2010-11-29  8:09     ` =?unknown-8bit?q?R=C3=A9mi?= Denis-Courmont
2010-11-26 19:51 ` [PATCH 1/3] Remove stray newlines in DBG and ofono log messages Denis Kenzior

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=4CF022A9.2070104@gmail.com \
    --to=denkenz@gmail.com \
    --cc=ofono@ofono.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