From 67b9dec6682b623451775039bb15db6f48847eb8 Mon Sep 17 00:00:00 2001 From: ewt Date: Tue, 7 May 1996 03:22:31 +0000 Subject: [PATCH] 1) fixed bug in reading $HOME/.rpmrc 2) allows rpmrc file to be overridden CVS patchset: 561 CVS date: 1996/05/07 03:22:31 --- lib/rpmrc.c | 31 +++++++++++++++++++------------ 1 file changed, 19 insertions(+), 12 deletions(-) diff --git a/lib/rpmrc.c b/lib/rpmrc.c index 5af3f05..fabaa4e 100644 --- a/lib/rpmrc.c +++ b/lib/rpmrc.c @@ -174,7 +174,7 @@ static void setDefaults(void) { setVar(RPMVAR_PGP_SECRING, "/usr/lib/rpm/secring.pgp"); } -int readConfigFiles(void) { +int readConfigFiles(char * file) { FILE * f; char * fn; char * home; @@ -182,23 +182,30 @@ int readConfigFiles(void) { setDefaults(); - f = fopen("/etc/rpmrc", "r"); + if (file) + fn = file; + else + fn = "/etc/rpmrc"; + + f = fopen(fn, "r"); if (f) { rc = readRpmrc(f, "/etc/rpmrc"); fclose(f); if (rc) return rc; } - home = getenv("HOME"); - if (home) { - fn = alloca(strlen(home) + 8); - strcpy(fn, home); - strcat(fn, "/.rpmrc"); - f = fopen("/etc/rpmrc", "r"); - if (f) { - rc |= readRpmrc(f, fn); - fclose(f); - if (rc) return rc; + if (!file) { + home = getenv("HOME"); + if (home) { + fn = alloca(strlen(home) + 8); + strcpy(fn, home); + strcat(fn, "/.rpmrc"); + f = fopen(fn, "r"); + if (f) { + rc |= readRpmrc(f, fn); + fclose(f); + if (rc) return rc; + } } } -- 2.7.4