summary refs log tree commit diff
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2014-06-29 23:53:18 +0200
committerLudovic Courtès <ludo@gnu.org>2014-06-29 23:53:18 +0200
commit1ddbd9fd71502c9332ca84a74734121c407a5708 (patch)
tree19906a96b6598affce1740330c0fa4320629790b
parent1abb614051c9b4299279c21e541bc1a7d2e99155 (diff)
downloadguix-1ddbd9fd71502c9332ca84a74734121c407a5708.tar.gz
guix-register: Add explicit libgcrypt initialization.
* nix/guix-register/guix-register.cc (main): Add calls to
  'gcry_check_version' and 'gcry_control', to appease libgcrypt.
-rw-r--r--nix/guix-register/guix-register.cc12
1 files changed, 12 insertions, 0 deletions
diff --git a/nix/guix-register/guix-register.cc b/nix/guix-register/guix-register.cc
index 324673f346..4aee4fde34 100644
--- a/nix/guix-register/guix-register.cc
+++ b/nix/guix-register/guix-register.cc
@@ -33,6 +33,7 @@
 #include <cstdio>
 
 #include <argp.h>
+#include <gcrypt.h>
 
 using namespace nix;
 
@@ -168,6 +169,17 @@ register_validity (LocalStore *store, std::istream &input,
 int
 main (int argc, char *argv[])
 {
+  /* Initialize libgcrypt, which is indirectly used.  */
+  if (!gcry_check_version (GCRYPT_VERSION))
+    {
+      fprintf (stderr, "error: libgcrypt version mismatch\n");
+      exit (EXIT_FAILURE);
+    }
+
+  /* Tell Libgcrypt that initialization has completed, as per the Libgcrypt
+     1.6.0 manual (although this does not appear to be strictly needed.)  */
+  gcry_control (GCRYCTL_INITIALIZATION_FINISHED, 0);
+
   /* Honor the environment variables, and initialize the settings.  */
   settings.processEnvironment ();