Open Source Telephony
 help / color / mirror / Atom feed
From: Denis Kenzior <denkenz@gmail.com>
To: ofono@ofono.org
Subject: Re: [PATCH 3/3] gisi: use strerror_r() instead of strerror()
Date: Fri, 26 Nov 2010 15:07:29 -0600	[thread overview]
Message-ID: <4CF02191.8000806@gmail.com> (raw)
In-Reply-To: <1290682265-11373-3-git-send-email-remi.denis-courmont@nokia.com>

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

Hi Remi,

On 11/25/2010 04:51 AM, Rémi Denis-Courmont wrote:
> ---
>  gisi/netlink.c |    8 ++++++--
>  gisi/server.c  |   11 ++++++++---
>  2 files changed, 14 insertions(+), 5 deletions(-)
> 
> diff --git a/gisi/netlink.c b/gisi/netlink.c
> index 44a4a8d..dcc322c 100644
> --- a/gisi/netlink.c
> +++ b/gisi/netlink.c
> @@ -240,8 +240,12 @@ static gboolean g_pn_nl_process(GIOChannel *channel, GIOCondition cond,
>  		case NLMSG_ERROR: {
>  			struct nlmsgerr *err = NLMSG_DATA(nlh);
>  			if (err->error)
> -				g_printerr("Netlink error: %s",
> -						strerror(-err->error));
> +			{
> +				char msg[256];
> +
> +				strerror_r(-err->error, msg, sizeof(msg));
> +				g_printerr("Netlink error: %s", msg);
> +			}

So my question is why we're using g_printerr in the first place inside a
library.  Perhaps an approach similar to g_at_chat_set_debug is in order?

>  			return TRUE;
>  		}
>  		case RTM_NEWADDR:
> diff --git a/gisi/server.c b/gisi/server.c
> index 159bb2d..df2e4eb 100644
> --- a/gisi/server.c
> +++ b/gisi/server.c
> @@ -157,7 +157,10 @@ g_isi_server_add_name(GIsiServer *self)
>  		return;
>  
>  	if (ioctl(self->fd, SIOCPNGETOBJECT, &object) < 0) {
> -		g_warning("%s: %s", "ioctl(SIOCPNGETOBJECT)", strerror(errno));
> +		char msg[256];
> +
> +		strerror_r(errno, msg, sizeof(msg));
> +		g_warning("%s: %s", "ioctl(SIOCPNGETOBJECT)", msg);
>  	} else {
>  		struct sockaddr_pn spn = {
>  			.spn_family = PF_PHONET,
> @@ -173,8 +176,10 @@ g_isi_server_add_name(GIsiServer *self)
>  
>  		if (sendto(self->fd, req, sizeof(req), 0,
>  				(void *)&spn, sizeof(spn)) != sizeof(req)) {
> -			g_warning("%s: %s", "sendto(PN_NAMESERVICE)",
> -				  strerror(errno));
> +			char msg[256];
> +
> +			strerror_r(errno, msg, sizeof(msg));
> +			g_warning("%s: %s", "sendto(PN_NAMESERVICE)", msg);
>  		}
>  	}
>  }

Regards,
-Denis

  reply	other threads:[~2010-11-26 21:07 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
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 [this message]
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=4CF02191.8000806@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