On Thu, Apr 15, 2021 at 1:50 PM Min Hu (Connor) <humi...@huawei.com> wrote:
> diff --git a/lib/librte_telemetry/telemetry.c 
> b/lib/librte_telemetry/telemetry.c
> index 7e08afd..e6a99f3 100644
> --- a/lib/librte_telemetry/telemetry.c
> +++ b/lib/librte_telemetry/telemetry.c
> @@ -350,6 +350,7 @@ socket_listener(void *socket)
>  {
>         while (1) {
>                 pthread_t th;
> +               int rc;
>                 struct socket *s = (struct socket *)socket;
>                 int s_accepted = accept(s->sock, NULL, NULL);
>                 if (s_accepted < 0) {
> @@ -366,7 +367,12 @@ socket_listener(void *socket)
>                         __atomic_add_fetch(s->num_clients, 1,
>                                         __ATOMIC_RELAXED);
>                 }
> -               pthread_create(&th, NULL, s->fn, (void 
> *)(uintptr_t)s_accepted);
> +               rc = pthread_create(&th, NULL, s->fn, (void 
> *)(uintptr_t)s_accepted);
> +               if (rc != 0) {
> +                       TMTY_LOG(ERR, "Error with create client thread\n");
> +                       close(s_accepted);
> +                       return NULL;
> +               }

Repeating my comment:

Either you use this rc variable (adding strerror(rc) in the log
message in TMTY_LOG()) or you remove the variable and simply test if
(pthread_create(...) != 0).

This comment applies to other changes in this patch.
And this applies to patch 2 too.

>                 pthread_detach(th);
>         }
>         return NULL;

Thanks.


--
David Marchand

Reply via email to