#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>
\f
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;
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;
}
/* _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 ();