From: Dwight Engen Date: Tue, 8 Oct 2013 16:22:57 +0000 (-0400) Subject: ensure gnutls is initialized before use X-Git-Tag: lxc-1.0.0.alpha2~37 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=41246cee3bc2b4215a485dd5da33d65ae5254514;p=thirdparty%2Flxc.git ensure gnutls is initialized before use Section 7.1.2 of the gnutls info manual states that it must be initialized with a call to gnutls_global_init before use. This fixes the syslog warning I was seeing: lxc-create: Libgcrypt warning: missing initialization - please fix the application Signed-off-by: Dwight Engen Acked-by: Stéphane Graber --- diff --git a/src/lxc/utils.c b/src/lxc/utils.c index dc94a3cdc..12ed454af 100644 --- a/src/lxc/utils.c +++ b/src/lxc/utils.c @@ -426,6 +426,13 @@ static inline int lock_fclose(FILE *f) #if HAVE_LIBGNUTLS #include #include + +__attribute__((constructor)) +static void gnutls_lxc_init(void) +{ + gnutls_global_init(); +} + int sha1sum_file(char *fnam, unsigned char *digest) { char *buf;