From: "Christian Biesinger via gdb-patches" <gdb-patches@sourceware.org>
To: Pedro Alves <palves@redhat.com>
Cc: gdb-patches <gdb-patches@sourceware.org>
Subject: Re: [PATCH] Replace the remaining uses of strerror with safe_strerror
Date: Mon, 09 Dec 2019 19:11:00 -0000 [thread overview]
Message-ID: <CAPTJ0XFN8KJJdyYdqZZPZvZcTysrJxTQ2YTK0p+zrWFyoX+nuw@mail.gmail.com> (raw)
In-Reply-To: <ebb496c1-91f2-6330-4143-c8ceab418058@redhat.com>
On Fri, Dec 6, 2019 at 4:46 PM Pedro Alves <palves@redhat.com> wrote:
>
> On 12/6/19 8:36 PM, Christian Biesinger wrote:
> > On Fri, Dec 6, 2019 at 2:06 PM Pedro Alves <palves@redhat.com> wrote:
>
> >> GDBserver and (I assume) the IPA can be built with other C runtimes on Linux,
> >> like musl and others. Do you know how musl behaves?
> >
> > Oof, looks like they return int :(
> > http://git.musl-libc.org/cgit/musl/tree/src/string/strerror_r.c
> >
> > I guess I'll change to #if defined(IN_PROCESS_AGENT) && defined(__GLIBC__)?
> >
>
> Crazy thought --- use C++ overload resolution to pick the right thing
> automatically:
>
> /* Called if we have a XSI-compliant strerror_r. */
> static char *select_strerror_r (int, char *buf) { return buf; }
>
> /* Called if we have a GNU strerror_r. */
> static char *select_strerror_r (char *res, char *) { return res; }
>
> #ifdef IN_PROCESS_AGENT
> return select_strerror_r (strerror_r (errnum, buf, buflen), buf);
> #else ...
Ah, great idea. That way I don't even need the #ifdef. Done, will send
a new version now.
Christian
next prev parent reply other threads:[~2019-12-09 19:11 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-11-26 19:59 Christian Biesinger via gdb-patches
2019-11-26 21:11 ` [PATCH v2] " Christian Biesinger via gdb-patches
2019-12-06 20:06 ` [PATCH] " Pedro Alves
2019-12-06 20:36 ` Christian Biesinger via gdb-patches
2019-12-06 20:44 ` [PATCH v3] " Christian Biesinger via gdb-patches
2019-12-06 21:46 ` [PATCH] " Pedro Alves
2019-12-09 19:11 ` Christian Biesinger via gdb-patches [this message]
2019-12-09 19:13 ` [PATCH v3] " Christian Biesinger via gdb-patches
2019-12-10 16:41 ` Pedro Alves
2019-12-10 19:25 ` Christian Biesinger via gdb-patches
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=CAPTJ0XFN8KJJdyYdqZZPZvZcTysrJxTQ2YTK0p+zrWFyoX+nuw@mail.gmail.com \
--to=gdb-patches@sourceware.org \
--cc=cbiesinger@google.com \
--cc=palves@redhat.com \
/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