diff options
author | Werner Koch <[email protected]> | 2021-09-22 08:18:30 +0000 |
---|---|---|
committer | Werner Koch <[email protected]> | 2021-11-25 10:40:59 +0000 |
commit | eb37d6469e722ae5ff187962c216474b5ec476de (patch) | |
tree | c9ecc5acf3c81c7eeeee5577bc05edbcb0ca9b80 /src/dirinfo.c | |
parent | posix: Use poll instead, when available, removing use of select. (diff) | |
download | gpgme-eb37d6469e722ae5ff187962c216474b5ec476de.tar.gz gpgme-eb37d6469e722ae5ff187962c216474b5ec476de.zip |
core: Support dirinfo("socketdir")
* src/dirinfo.c (WANT_SOCKETDIR): New.
(dirinfo): Add field socketdir.
(parse_output): Support "socketdir".
(get_gpgconf_item): Return socketdir.
* tests/t-engine-info.c (main): Add socketdir to the output.
* src/w32-util.c (_gpgme_create_process_utf8): Fix indentation.
--
GnuPG-bug-id: 5613
This is not strictly necessary because we could deduce this from one
of the other socket info items but it is more clean to have a
dedicated info item. The socketdir item is available for 5 years now
(GnuPG commit 8e3fa5a4b205c534de2142e5d071712f957cf06a)
Diffstat (limited to 'src/dirinfo.c')
-rw-r--r-- | src/dirinfo.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/dirinfo.c b/src/dirinfo.c index c4f0e4a0..c6b7d718 100644 --- a/src/dirinfo.c +++ b/src/dirinfo.c @@ -44,6 +44,7 @@ enum WANT_LIBDIR, WANT_DATADIR, WANT_LOCALEDIR, + WANT_SOCKETDIR, WANT_AGENT_SOCKET, WANT_AGENT_SSH_SOCKET, WANT_DIRMNGR_SOCKET, @@ -67,6 +68,7 @@ static struct { char *libdir; char *datadir; char *localedir; + char *socketdir; char *agent_socket; char *agent_ssh_socket; char *dirmngr_socket; @@ -152,6 +154,8 @@ parse_output (char *line, int components) dirinfo.datadir = strdup (value); else if (!strcmp (line, "localedir") && !dirinfo.localedir) dirinfo.localedir = strdup (value); + else if (!strcmp (line, "socketdir") && !dirinfo.socketdir) + dirinfo.socketdir = strdup (value); else if (!strcmp (line, "agent-socket") && !dirinfo.agent_socket) { const char name[] = "S.uiserver"; @@ -310,6 +314,10 @@ get_gpgconf_item (int what) _gpgme_debug (NULL, DEBUG_INIT, -1, NULL, NULL, NULL, "gpgme-dinfo: homedir='%s'\n", dirinfo.homedir); + if (dirinfo.socketdir) + _gpgme_debug (NULL, DEBUG_INIT, -1, NULL, NULL, NULL, + "gpgme-dinfo: sockdir='%s'\n", + dirinfo.socketdir); if (dirinfo.agent_socket) _gpgme_debug (NULL,DEBUG_INIT, -1, NULL, NULL, NULL, "gpgme-dinfo: agent='%s'\n", @@ -336,6 +344,7 @@ get_gpgconf_item (int what) case WANT_LIBDIR: result = dirinfo.libdir; break; case WANT_DATADIR: result = dirinfo.datadir; break; case WANT_LOCALEDIR: result = dirinfo.localedir; break; + case WANT_SOCKETDIR: result = dirinfo.socketdir; break; case WANT_AGENT_SOCKET: result = dirinfo.agent_socket; break; case WANT_AGENT_SSH_SOCKET: result = dirinfo.agent_ssh_socket; break; case WANT_DIRMNGR_SOCKET: result = dirinfo.dirmngr_socket; break; @@ -476,6 +485,8 @@ gpgme_get_dirinfo (const char *what) return get_gpgconf_item (WANT_DATADIR); else if (!strcmp (what, "localedir")) return get_gpgconf_item (WANT_LOCALEDIR); + else if (!strcmp (what, "socketdir")) + return get_gpgconf_item (WANT_SOCKETDIR); else return NULL; } |