summaryrefslogtreecommitdiffstats
path: root/lib/libalpm
diff options
context:
space:
mode:
authorAndrew Gregory <andrew.gregory.8@gmail.com>2016-02-22 03:46:36 +0100
committerAllan McRae <allan@archlinux.org>2016-02-23 03:32:54 +0100
commitce1f453b74c8fd0966e1d11d3deeb1a777055fc5 (patch)
treedff2c4ed7b09c83eb13f48e8dae99ef11d0f0e2f /lib/libalpm
parent2ee7a8d89ad693617307260604e1d58757fd2978 (diff)
downloadpacman-ce1f453b74c8fd0966e1d11d3deeb1a777055fc5.tar.gz
pacman-ce1f453b74c8fd0966e1d11d3deeb1a777055fc5.tar.xz
ensure gpgdir has a trailing slash
init_gpgme checks for various paths under gpgdir by concatenating them directly, giving warning messages incorrectly if gpgdir does not end with '/'. Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
Diffstat (limited to 'lib/libalpm')
-rw-r--r--lib/libalpm/handle.c12
1 files changed, 3 insertions, 9 deletions
diff --git a/lib/libalpm/handle.c b/lib/libalpm/handle.c
index 37c0bbfb..e4bde1a7 100644
--- a/lib/libalpm/handle.c
+++ b/lib/libalpm/handle.c
@@ -542,17 +542,11 @@ int SYMEXPORT alpm_option_set_logfile(alpm_handle_t *handle, const char *logfile
int SYMEXPORT alpm_option_set_gpgdir(alpm_handle_t *handle, const char *gpgdir)
{
+ int err;
CHECK_HANDLE(handle, return -1);
- if(!gpgdir) {
- handle->pm_errno = ALPM_ERR_WRONG_ARGS;
- return -1;
+ if((err = _alpm_set_directory_option(gpgdir, &(handle->gpgdir), 0))) {
+ RET_ERR(handle, err, -1);
}
-
- if(handle->gpgdir) {
- FREE(handle->gpgdir);
- }
- STRDUP(handle->gpgdir, gpgdir, RET_ERR(handle, ALPM_ERR_MEMORY, -1));
-
_alpm_log(handle, ALPM_LOG_DEBUG, "option 'gpgdir' = %s\n", handle->gpgdir);
return 0;
}