Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Pedro Alves <palves@redhat.com>
To: Christian Biesinger <cbiesinger@google.com>
Cc: gdb-patches <gdb-patches@sourceware.org>
Subject: Re: [PATCH] Replace the remaining uses of strerror with safe_strerror
Date: Fri, 06 Dec 2019 21:46:00 -0000	[thread overview]
Message-ID: <ebb496c1-91f2-6330-4143-c8ceab418058@redhat.com> (raw)
In-Reply-To: <CAPTJ0XH-tVAyf=BGB4HVBapqJ7_gNL5Xvt+vLnHvKRX+8+KtsQ@mail.gmail.com>

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 ...

Thanks,
Pedro Alves


  parent reply	other threads:[~2019-12-06 21:46 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     ` Pedro Alves [this message]
2019-12-09 19:11       ` [PATCH] " Christian Biesinger via gdb-patches
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=ebb496c1-91f2-6330-4143-c8ceab418058@redhat.com \
    --to=palves@redhat.com \
    --cc=cbiesinger@google.com \
    --cc=gdb-patches@sourceware.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