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 4 : static int gpg_available (KeySet * conf)
11 : {
12 4 : int available = 0;
13 4 : char * gpgPath = NULL;
14 4 : Key * parentKey = keyNew ("system:/", KEY_END);
15 :
16 4 : int gpg_search_result = ELEKTRA_PLUGIN_FUNCTION (gpgGetBinary) (&gpgPath, conf, parentKey);
17 4 : if (gpg_search_result == 1)
18 : {
19 4 : available = 1;
20 : }
21 :
22 4 : if (gpgPath)
23 : {
24 4 : elektraFree (gpgPath);
25 : }
26 4 : keyDel (parentKey);
27 4 : ksDel (conf);
28 4 : return available;
29 : }
|