From 5bf7c546a6b7ccdd09e60d7c7303976b285cb2bc Mon Sep 17 00:00:00 2001 Message-Id: <5bf7c546a6b7ccdd09e60d7c7303976b285cb2bc.1715505338.git.mdw@distorted.org.uk> From: Mark Wooding Date: Sun, 8 Mar 2009 13:34:33 +0000 Subject: [PATCH] gcrypt initialization to suppress warning message. Not really anything to do with the uaudio branch as such but found here and fixing it here will likely save a conflict when we merge. Organization: Straylight/Edgeware From: Richard Kettlewell --- clients/disorder.c | 6 ++++++ disobedience/disobedience.c | 6 ++++++ server/disorderd.c | 3 +++ server/speaker.c | 6 ++++++ 4 files changed, 21 insertions(+) diff --git a/clients/disorder.c b/clients/disorder.c index 8dc6d7f..5f725e8 100644 --- a/clients/disorder.c +++ b/clients/disorder.c @@ -32,6 +32,7 @@ #include #include #include +#include #include "configuration.h" #include "syscalls.h" @@ -764,6 +765,11 @@ int main(int argc, char **argv) { config->connect.n = 0; n = optind; optind = 1; /* for subsequent getopt calls */ + /* gcrypt initialization */ + if(!gcry_check_version(NULL)) + disorder_fatal(0, "gcry_check_version failed"); + gcry_control(GCRYCTL_INIT_SECMEM, 0); + gcry_control (GCRYCTL_INITIALIZATION_FINISHED, 0); /* accumulate command args */ while(n < argc) { if((i = TABLE_FIND(commands, name, argv[n])) < 0) diff --git a/disobedience/disobedience.c b/disobedience/disobedience.c index e0fa295..dea9d59 100644 --- a/disobedience/disobedience.c +++ b/disobedience/disobedience.c @@ -25,6 +25,7 @@ #include #include #include +#include /* Apologies for the numerous de-consting casts, but GLib et al do not seem to * have heard of const. */ @@ -448,6 +449,11 @@ int main(int argc, char **argv) { } if(!gtkok) fatal(0, "failed to initialize GTK+"); + /* gcrypt initialization */ + if(!gcry_check_version(NULL)) + disorder_fatal(0, "gcry_check_version failed"); + gcry_control(GCRYCTL_INIT_SECMEM, 0); + gcry_control (GCRYCTL_INITIALIZATION_FINISHED, 0); signal(SIGPIPE, SIG_IGN); init_styles(); load_settings(); diff --git a/server/disorderd.c b/server/disorderd.c index 72a8e3d..74fc07e 100644 --- a/server/disorderd.c +++ b/server/disorderd.c @@ -209,7 +209,10 @@ int main(int argc, char **argv) { fix_path(); srand(time(0)); /* don't start the same every time */ /* gcrypt initialization */ + if(!gcry_check_version(NULL)) + disorder_fatal(0, "gcry_check_version failed"); gcry_control(GCRYCTL_INIT_SECMEM, 1); + gcry_control (GCRYCTL_INITIALIZATION_FINISHED, 0); /* make sure we can't have more than FD_SETSIZE files open (event.c does * check but this provides an additional line of defence) */ if(getrlimit(RLIMIT_NOFILE, rl) < 0) diff --git a/server/speaker.c b/server/speaker.c index 123f7a2..cc1764e 100644 --- a/server/speaker.c +++ b/server/speaker.c @@ -80,6 +80,7 @@ #include #include #include +#include #include "configuration.h" #include "syscalls.h" @@ -652,6 +653,11 @@ int main(int argc, char **argv) { info("set RLIM_NOFILE to %lu", (unsigned long)rl->rlim_cur); } else info("RLIM_NOFILE is %lu", (unsigned long)rl->rlim_cur); + /* gcrypt initialization */ + if(!gcry_check_version(NULL)) + disorder_fatal(0, "gcry_check_version failed"); + gcry_control(GCRYCTL_INIT_SECMEM, 0); + gcry_control (GCRYCTL_INITIALIZATION_FINISHED, 0); /* create a pipe between the backend callback and the poll() loop */ xpipe(sigpipe); nonblock(sigpipe[0]); -- [mdw]