diff options
author | Dimitri Staessens <[email protected]> | 2019-07-26 12:07:21 +0200 |
---|---|---|
committer | Sander Vrijders <[email protected]> | 2019-07-29 19:58:20 +0200 |
commit | 8a37ffbf8c0776a38f2de18a63e885383960ee68 (patch) | |
tree | 1f8c7fc954f47b561281a23b4510546f3e501f99 /src/irmd/main.c | |
parent | dae15c284248d49079ad5f8a3d8ff30e217f419e (diff) | |
download | ouroboros-8a37ffbf8c0776a38f2de18a63e885383960ee68.tar.gz ouroboros-8a37ffbf8c0776a38f2de18a63e885383960ee68.zip |
irmd, lib: Improve libgcrypt init
The proper initialization of libgrypt requires a call to
gcry_check_version. The library initialization should first run a
check if the application (or some other library) hasn't already
initialized libgcrypt before attempting to initialize libgcrypt.
Signed-off-by: Dimitri Staessens <[email protected]>
Signed-off-by: Sander Vrijders <[email protected]>
Diffstat (limited to 'src/irmd/main.c')
-rw-r--r-- | src/irmd/main.c | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/src/irmd/main.c b/src/irmd/main.c index 5875d7dc..f3a3ff87 100644 --- a/src/irmd/main.c +++ b/src/irmd/main.c @@ -2206,12 +2206,18 @@ static int irm_init(void) #endif #ifdef HAVE_LIBGCRYPT - if (gcry_control(GCRYCTL_ANY_INITIALIZATION_P)) - goto fail_gcry_control; + if (!gcry_check_version(GCRYPT_VERSION)) { + log_err("Error checking libgcrypt version."); + goto fail_gcry_version; + } + + if (!gcry_control(GCRYCTL_ANY_INITIALIZATION_P)) { + log_err("Libgcrypt was not initialized."); + goto fail_gcry_version; + } gcry_control(GCRYCTL_INITIALIZATION_FINISHED); #endif - irmd_set_state(IRMD_RUNNING); log_info("Ouroboros IPC Resource Manager daemon started..."); @@ -2219,7 +2225,10 @@ static int irm_init(void) return 0; #ifdef HAVE_LIBGCRYPT - fail_gcry_control: + fail_gcry_version: +#ifdef HAVE_FUSE + rmdir(FUSE_PREFIX); +#endif shm_rdrbuff_destroy(irmd.rdrb); #endif fail_rdrbuff: |