From a7a9595d9b1885fb57a27b76f15bb9ce09203949 Mon Sep 17 00:00:00 2001 From: Panu Matilainen Date: Tue, 3 Jun 2008 13:39:07 +0300 Subject: [PATCH] Rip dosetenv() - just use regular setenv() instead - we already carry setenv() in misc/ for platforms that don't have it --- lib/misc.c | 12 ------------ lib/misc.h | 9 --------- lib/signature.c | 17 ++++++++--------- 3 files changed, 8 insertions(+), 30 deletions(-) diff --git a/lib/misc.c b/lib/misc.c index 15d5a9d..d8e9679 100644 --- a/lib/misc.c +++ b/lib/misc.c @@ -44,15 +44,3 @@ int doputenv(const char *str) return putenv(a); } -int dosetenv(const char * name, const char * value, int overwrite) -{ - char * a; - - if (!overwrite && getenv(name)) return 0; - - /* FIXME: this leaks memory! */ - a = xmalloc(strlen(name) + strlen(value) + sizeof("=")); - (void) stpcpy( stpcpy( stpcpy( a, name), "="), value); - return putenv(a); -} - diff --git a/lib/misc.h b/lib/misc.h index 049b2ca..574c468 100644 --- a/lib/misc.h +++ b/lib/misc.h @@ -24,15 +24,6 @@ rpmRC rpmMkdirPath (const char * dpath, const char * dname); /** * Like the libc function, but malloc()'s the space needed. - * @param name variable name - * @param value variable value - * @param overwrite should an existing variable be changed? - * @return 0 on success - */ -int dosetenv(const char * name, const char * value, int overwrite); - -/** - * Like the libc function, but malloc()'s the space needed. * @param str "name=value" string * @return 0 on success */ diff --git a/lib/signature.c b/lib/signature.c index b3e7f42..c507b7c 100644 --- a/lib/signature.c +++ b/lib/signature.c @@ -16,7 +16,6 @@ #include #include "rpmio/digest.h" -#include "lib/misc.h" /* XXX for dosetenv() */ #include "lib/rpmlead.h" #include "lib/signature.h" #include "lib/header_internal.h" @@ -384,11 +383,11 @@ static int makePGPSignature(const char * file, rpmSigTag * sigTagp, (void) dup2(inpipe[0], 3); (void) close(inpipe[1]); - (void) dosetenv("PGPPASSFD", "3", 1); + (void) setenv("PGPPASSFD", "3", 1); if (pgp_path && *pgp_path != '\0') - (void) dosetenv("PGPPATH", pgp_path, 1); + (void) setenv("PGPPATH", pgp_path, 1); - /* dosetenv("PGPPASS", passPhrase, 1); */ + /* setenv("PGPPASS", passPhrase, 1); */ unsetenv("MALLOC_CHECK_"); if ((path = rpmDetectPGPVersion(&pgpVer)) != NULL) { @@ -520,8 +519,8 @@ static int makeGPGSignature(const char * file, rpmSigTag * sigTagp, (void) close(inpipe[1]); if (gpg_path && *gpg_path != '\0') - (void) dosetenv("GNUPGHOME", gpg_path, 1); - (void) dosetenv("LC_ALL", "C", 1); + (void) setenv("GNUPGHOME", gpg_path, 1); + (void) setenv("LC_ALL", "C", 1); unsetenv("MALLOC_CHECK_"); cmd = rpmExpand("%{?__gpg_sign_cmd}", NULL); @@ -845,7 +844,7 @@ static int checkPassPhrase(const char * passPhrase, const rpmSigTag sigTag) { const char *gpg_path = rpmExpand("%{?_gpg_path}", NULL); if (gpg_path && *gpg_path != '\0') - (void) dosetenv("GNUPGHOME", gpg_path, 1); + (void) setenv("GNUPGHOME", gpg_path, 1); cmd = rpmExpand("%{?__gpg_check_password_cmd}", NULL); rc = poptParseArgvString(cmd, NULL, (const char ***)&av); @@ -862,9 +861,9 @@ static int checkPassPhrase(const char * passPhrase, const rpmSigTag sigTag) const char *path; pgpVersion pgpVer; - (void) dosetenv("PGPPASSFD", "3", 1); + (void) setenv("PGPPASSFD", "3", 1); if (pgp_path && *pgp_path != '\0') - xx = dosetenv("PGPPATH", pgp_path, 1); + xx = setenv("PGPPATH", pgp_path, 1); if ((path = rpmDetectPGPVersion(&pgpVer)) != NULL) { switch(pgpVer) { -- 2.7.4