[PATCH v3] Replace the remaining uses of strerror with safe_strerror

Pedro Alves palves@redhat.com
Tue Dec 10 16:41:00 GMT 2019


On 12/9/19 7:13 PM, Christian Biesinger via gdb-patches wrote:

> +/* There are two different versions of strerror_r; one is GNU-specific, the
> +   other XSI-compliant.  They differ in the return type.  This overload lets
> +   us choose the right behavior for each return type.  We cannot rely on Gnulib
> +   to solve this for us because IPA does not use Gnulib but uses this
> +   function.  */
> +
> +/* Called if we have a XSI-compliant strerror_r.  */
> +static char *select_strerror_r (int res, char *buf)

Formatting:

static char *
select_strerror_r (int res, char *buf)


> +{
> +  return res == 0 ? buf : nullptr;
> +}
> +
> +/* Called if we have a GNU strerror_r.  */
> +static char *select_strerror_r (char *res, char *)

Ditto.

> +{
> +  return res;
> +}
> +
OK with those changes.

Thanks,
Pedro Alves



More information about the Gdb-patches mailing list