Consider macro file load fail on any errors

The previous "only fail if everything fails" behavior from commit
f7aff1193e is just too arbitrary to live.
If there was a failure, it failed. Period.
This commit is contained in:
Panu Matilainen 2019-05-17 09:38:29 +03:00 committed by Florian Festi
parent d86c0c28ab
commit 05366596a6
1 changed files with 1 additions and 4 deletions

View File

@ -1599,7 +1599,6 @@ static int loadMacroFile(rpmMacroContext mc, const char * fn)
size_t blen = MACROBUFSIZ;
char *buf = xmalloc(blen);
int rc = -1;
int ndefs = 0;
int nfailed = 0;
if (fd == NULL)
@ -1615,14 +1614,12 @@ static int loadMacroFile(rpmMacroContext mc, const char * fn)
if (c != '%')
continue;
n++; /* skip % */
ndefs++;
if (defineMacro(mc, n, RMIL_MACROFILES))
nfailed++;
}
fclose(fd);
/* if all definitions fail then return an error, otherwise just warn */
rc = (nfailed && ndefs == nfailed);
rc = (nfailed > 0);
if (nfailed) {
rpmlog(rc ? RPMLOG_ERR : RPMLOG_WARNING,