summary refs log tree commit diff
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2013-01-02 01:07:53 +0100
committerLudovic Courtès <ludo@gnu.org>2013-01-02 01:07:53 +0100
commit5501e6b64fb6ea44d8d549b076fc13078c7d5b6c (patch)
tree465edca1977214d934a125fc9bad68d38f3a5b19
parent03fa275801263a123495c723cbafe478cc0f3d95 (diff)
downloadguix-5501e6b64fb6ea44d8d549b076fc13078c7d5b6c.tar.gz
daemon: Properly initialize libgcrypt.
* nix/nix-daemon/guix-daemon.cc (main): Call `gcry_check_version'.
-rw-r--r--nix/nix-daemon/guix-daemon.cc11
1 files changed, 10 insertions, 1 deletions
diff --git a/nix/nix-daemon/guix-daemon.cc b/nix/nix-daemon/guix-daemon.cc
index 6ffc8f04ad..823eeb674e 100644
--- a/nix/nix-daemon/guix-daemon.cc
+++ b/nix/nix-daemon/guix-daemon.cc
@@ -1,5 +1,5 @@
 /* Guix --- Nix package management from Guile.         -*- coding: utf-8 -*-
-   Copyright (C) 2012  Ludovic Courtès <ludo@gnu.org>
+   Copyright (C) 2012, 2013  Ludovic Courtès <ludo@gnu.org>
 
    This file is part of Guix.
 
@@ -23,6 +23,8 @@
 #include <globals.hh>
 #include <util.hh>
 
+#include <gcrypt.h>
+
 #include <stdlib.h>
 #include <argp.h>
 #include <unistd.h>
@@ -165,6 +167,13 @@ main (int argc, char *argv[])
 {
   Strings nothing;
 
+  /* Initialize libgcrypt.  */
+  if (!gcry_check_version (GCRYPT_VERSION))
+    {
+      fprintf (stderr, "error: libgcrypt version mismatch\n");
+      exit (EXIT_FAILURE);
+    }
+
 #ifdef HAVE_CHROOT
   settings.useChroot = true;
 #else