comparison freeDiameter/main.c @ 213:890a9b6379f0

Fix initialization order for gnutls
author Sebastien Decugis <sdecugis@nict.go.jp>
date Thu, 18 Feb 2010 14:50:11 +0900
parents c32f48b89cfb
children 5a1b93f59f8f
comparison
equal deleted inserted replaced
212:c32f48b89cfb 213:890a9b6379f0
71 TRACE_DEBUG(INFO, "libfreeDiameter initialized."); 71 TRACE_DEBUG(INFO, "libfreeDiameter initialized.");
72 72
73 /* Name this thread */ 73 /* Name this thread */
74 fd_log_threadname("Main"); 74 fd_log_threadname("Main");
75 75
76 /* Initialize the config */
77 CHECK_FCT( fd_conf_init() );
78
79 /* Parse the command-line */
80 CHECK_FCT( main_cmdline(argc, argv) );
81
82 /* Initialize gcrypt and gnutls */ 76 /* Initialize gcrypt and gnutls */
83 (void) gcry_control (GCRYCTL_SET_THREAD_CBS, &gcry_threads_pthread); 77 (void) gcry_control (GCRYCTL_SET_THREAD_CBS, &gcry_threads_pthread);
84 (void) gcry_control (GCRYCTL_ENABLE_QUICK_RANDOM, 0); 78 (void) gcry_control (GCRYCTL_ENABLE_QUICK_RANDOM, 0);
85 (void) gcry_control (GCRYCTL_DISABLE_SECMEM, NULL, 0); 79 (void) gcry_control (GCRYCTL_DISABLE_SECMEM, NULL, 0);
86 CHECK_GNUTLS_DO( gnutls_global_init(), return EINVAL ); 80 CHECK_GNUTLS_DO( gnutls_global_init(), return EINVAL );
88 fprintf(stderr, "The GNUTLS library is too old; found '%s', need '" GNUTLS_VERSION "'\n", gnutls_check_version(NULL)); 82 fprintf(stderr, "The GNUTLS library is too old; found '%s', need '" GNUTLS_VERSION "'\n", gnutls_check_version(NULL));
89 return EINVAL; 83 return EINVAL;
90 } else { 84 } else {
91 TRACE_DEBUG(INFO, "GNUTLS library '%s' initialized.", gnutls_check_version(NULL)); 85 TRACE_DEBUG(INFO, "GNUTLS library '%s' initialized.", gnutls_check_version(NULL));
92 } 86 }
87
88 /* Initialize the config */
89 CHECK_FCT( fd_conf_init() );
90
91 /* Parse the command-line */
92 CHECK_FCT( main_cmdline(argc, argv) );
93 93
94 /* Allow SIGINT and SIGTERM from this point */ 94 /* Allow SIGINT and SIGTERM from this point */
95 CHECK_POSIX( pthread_create(&sig_th, NULL, sig_hdl, NULL) ); 95 CHECK_POSIX( pthread_create(&sig_th, NULL, sig_hdl, NULL) );
96 96
97 /* Add definitions of the base protocol */ 97 /* Add definitions of the base protocol */
"Welcome to our mercurial repository"