[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAPhsuW7JUpoT-MFz7py12Vyj0Qm1zXDkN8Wq+KGM44tomrPipA@mail.gmail.com>
Date: Fri, 28 Jun 2019 12:34:57 -0700
From: Song Liu <liu.song.a23@...il.com>
To: Andrii Nakryiko <andriin@...com>
Cc: Andrii Nakryiko <andrii.nakryiko@...il.com>,
Alexei Starovoitov <ast@...com>,
Daniel Borkmann <daniel@...earbox.net>,
Networking <netdev@...r.kernel.org>, bpf <bpf@...r.kernel.org>,
Stanislav Fomichev <sdf@...ichev.me>,
Kernel Team <kernel-team@...com>
Subject: Re: [PATCH v3 bpf-next 1/9] libbpf: make libbpf_strerror_r agnostic
to sign of error
On Thu, Jun 27, 2019 at 10:53 PM Andrii Nakryiko <andriin@...com> wrote:
>
> It's often inconvenient to switch sign of error when passing it into
> libbpf_strerror_r. It's better for it to handle that automatically.
>
> Signed-off-by: Andrii Nakryiko <andriin@...com>
> Reviewed-by: Stanislav Fomichev <sdf@...gle.com>
Acked-by: Song Liu <songliubraving@...com>
> ---
> tools/lib/bpf/str_error.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/tools/lib/bpf/str_error.c b/tools/lib/bpf/str_error.c
> index 00e48ac5b806..b8064eedc177 100644
> --- a/tools/lib/bpf/str_error.c
> +++ b/tools/lib/bpf/str_error.c
> @@ -11,7 +11,7 @@
> */
> char *libbpf_strerror_r(int err, char *dst, int len)
> {
> - int ret = strerror_r(err, dst, len);
> + int ret = strerror_r(err < 0 ? -err : err, dst, len);
> if (ret)
> snprintf(dst, len, "ERROR: strerror_r(%d)=%d", err, ret);
> return dst;
> --
> 2.17.1
>
Powered by blists - more mailing lists