]> git.ipfire.org Git - thirdparty/lxc.git/commitdiff
ensure gnutls is initialized before use
authorDwight Engen <dwight.engen@oracle.com>
Tue, 8 Oct 2013 16:22:57 +0000 (12:22 -0400)
committerStéphane Graber <stgraber@ubuntu.com>
Tue, 8 Oct 2013 16:47:58 +0000 (12:47 -0400)
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 <dwight.engen@oracle.com>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
src/lxc/utils.c

index dc94a3cdc0671664f924b3ae86465e033581d592..12ed454afe4e8ddea6db56d740db9499f89f8305 100644 (file)
@@ -426,6 +426,13 @@ static inline int lock_fclose(FILE *f)
 #if HAVE_LIBGNUTLS
 #include <gnutls/gnutls.h>
 #include <gnutls/crypto.h>
+
+__attribute__((constructor))
+static void gnutls_lxc_init(void)
+{
+       gnutls_global_init();
+}
+
 int sha1sum_file(char *fnam, unsigned char *digest)
 {
        char *buf;