Line data Source code
1 : /**
2 : * @file
3 : *
4 : * @brief common functions for gpg-related unit testing.
5 : *
6 : * @copyright BSD License (see LICENSE.md or https://www.libelektra.org)
7 : *
8 : */
9 :
10 1 : static int gpg_available (KeySet * conf)
11 : {
12 1 : int available = 0;
13 1 : char * gpgPath = NULL;
14 1 : Key * parentKey = keyNew ("system", KEY_END);
15 :
16 1 : int gpg_search_result = ELEKTRA_PLUGIN_FUNCTION (gpgGetBinary) (&gpgPath, conf, parentKey);
17 1 : if (gpg_search_result == 1)
18 : {
19 1 : available = 1;
20 : }
21 :
22 1 : if (gpgPath)
23 : {
24 1 : elektraFree (gpgPath);
25 : }
26 1 : keyDel (parentKey);
27 1 : ksDel (conf);
28 1 : return available;
29 : }
|