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