Comment 7 for bug 869166

Revision history for this message
Andreas Hasenack (ahasenack) wrote :

@juhaz and others, what do you think of this attached patch variant? It checks if the library was already initialised before doing it. Since libpam is a library, this is following the recommendation in gcrypt.info, and in https://lists.gnupg.org/pipermail/gcrypt-devel/2003-August/000458.html:

"""
Becuase you can't know in a library whether another library has
already initialized the library, I suggest to do this:

 if (!gcry_control (GCRYCTL_ANY_INITIALIZATION_P))
   { /* No other library has already initialized libgcrypt. */

     if (!gcry_check_version (NEED_LIBGCRYPT_VERSION) )
       {
          log_fatal (_("libgcrypt is too old (need %s, have %s)\n"),
                     NEED_LIBGCRYPT_VERSION, gcry_check_version (NULL));
       }
     gcry_set_allocation_handler (...);
     gcry_control (GCRYCTL_INITIALIZATION_FINISHED);
   }
"""