Re: [PATCH 1/1] daemon: initialize pthread key before attempting to log

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, 2022-05-12 at 16:41 -0700, Clayton Craft wrote:
> Fixes a segfault when running the automount daemon with -v, where
> log.c:prepare_attempt_prefix calls pthread_getspecific when no
> key_thread_attempt_id exists.

Could you have a look at commit ab9570be7ee7 and adjust this patch
as needed if it is needed please.

> 
> Signed-off-by: Clayton Craft <clayton@xxxxxxxxxx>
> ---
>  daemon/automount.c | 20 ++++++++++----------
>  1 file changed, 10 insertions(+), 10 deletions(-)
> 
> diff --git a/daemon/automount.c b/daemon/automount.c
> index 32f95a5..b941129 100644
> --- a/daemon/automount.c
> +++ b/daemon/automount.c
> @@ -2629,15 +2629,9 @@ int main(int argc, char *argv[])
>                 exit(1);
>         }
>  
> -       info(logging, "Starting automounter version %s, master map
> %s",
> -               version, master_list->name);
> -       info(logging, "using kernel protocol version %d.%02d",
> -               get_kver_major(), get_kver_minor());
> -
> -       status = pthread_key_create(&key_thread_stdenv_vars,
> -                               key_thread_stdenv_vars_destroy);
> +       status = pthread_key_create(&key_thread_attempt_id, free);
>         if (status) {
> -               logerr("%s: failed to create thread data key for std
> env vars!",
> +               logerr("%s: failed to create thread data key for
> attempt ID!",
>                        program);
>                 master_kill(master_list);
>                 if (start_pipefd[1] != -1) {
> @@ -2649,9 +2643,15 @@ int main(int argc, char *argv[])
>                 exit(1);
>         }
>  
> -       status = pthread_key_create(&key_thread_attempt_id, free);
> +       info(logging, "Starting automounter version %s, master map
> %s",
> +               version, master_list->name);
> +       info(logging, "using kernel protocol version %d.%02d",
> +               get_kver_major(), get_kver_minor());
> +
> +       status = pthread_key_create(&key_thread_stdenv_vars,
> +                               key_thread_stdenv_vars_destroy);
>         if (status) {
> -               logerr("%s: failed to create thread data key for
> attempt ID!",
> +               logerr("%s: failed to create thread data key for std
> env vars!",
>                        program);
>                 master_kill(master_list);
>                 if (start_pipefd[1] != -1) {




[Index of Archives]     [Linux Filesystem Development]     [Linux Ext4]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux