aboutsummaryrefslogtreecommitdiffstats
path: root/src/engine-gpgconf.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/engine-gpgconf.c')
-rw-r--r--src/engine-gpgconf.c16
1 files changed, 10 insertions, 6 deletions
diff --git a/src/engine-gpgconf.c b/src/engine-gpgconf.c
index cf4df568..6807dce9 100644
--- a/src/engine-gpgconf.c
+++ b/src/engine-gpgconf.c
@@ -24,7 +24,9 @@
#include <stdlib.h>
#include <string.h>
-#include <sys/types.h>
+#ifdef HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
#include <assert.h>
#ifdef HAVE_UNISTD_H
# include <unistd.h>
@@ -535,7 +537,7 @@ gpgconf_conf_load (void *engine, gpgme_conf_comp_t *comp_p)
gpgme_error_t
_gpgme_conf_arg_new (gpgme_conf_arg_t *arg_p,
- gpgme_conf_type_t type, void *value)
+ gpgme_conf_type_t type, const void *value)
{
gpgme_conf_arg_t arg;
@@ -616,16 +618,19 @@ _gpgme_conf_arg_release (gpgme_conf_arg_t arg, gpgme_conf_type_t type)
gpgme_error_t
_gpgme_conf_opt_change (gpgme_conf_opt_t opt, int reset, gpgme_conf_arg_t arg)
{
- if (opt->new_value)
- release_arg (opt->new_value, opt->alt_type);
-
if (reset)
{
+ if (opt->new_value)
+ release_arg (opt->new_value, opt->alt_type);
opt->new_value = NULL;
opt->change_value = 0;
}
else
{
+ /* Support self-assignment, for example for adding an item to an
+ existing list. */
+ if (opt->new_value && arg != opt->new_value)
+ release_arg (opt->new_value, opt->alt_type);
opt->new_value = arg;
opt->change_value = 1;
}
@@ -653,7 +658,6 @@ gpgconf_write (void *engine, char *arg1, char *arg2, gpgme_data_t conf)
/* _gpgme_engine_new guarantees that this is not NULL. */
argv[0] = gpgconf->file_name;
- argv[0] = "/nowhere/path-needs-to-be-fixed/gpgconf";
if (_gpgme_io_pipe (rp, 0) < 0)
return gpg_error_from_syserror ();