Fix and test for macLib losing error status

Problem found & diagnosed by Mark Rivers.
This commit is contained in:
Andrew Johnson
2017-04-17 11:47:21 -05:00
parent e0af3e2af5
commit d4552af39b
2 changed files with 6 additions and 3 deletions

View File

@@ -857,9 +857,9 @@ static void refer ( MAC_HANDLE *handle, MAC_ENTRY *entry, int level,
if ( !refentry->visited ) {
/* reference is good, use it */
if ( !handle->dirty ) {
/* copy the already-expanded value, and its error status! */
/* copy the already-expanded value, merge any error status */
cpy2val( refentry->value, &v, valend );
entry->error = refentry->error;
entry->error = entry->error || refentry->error;
} else {
/* translate raw value */
const char *rv = refentry->rawval;

View File

@@ -65,7 +65,7 @@ static void ovcheck(void)
MAIN(macLibTest)
{
testPlan(89);
testPlan(91);
if (macCreateHandle(&h, NULL))
testAbort("macCreateHandle() failed");
@@ -203,6 +203,9 @@ MAIN(macLibTest)
/* STR2 = "VAL2" */
check("${FOO}", " VAL2");
check("$(FOO)$(FOO1)", "!VAL2$(FOO1,undefined)");
check("$(FOO1)$(FOO)", "!$(FOO1,undefined)VAL2");
macPutValue(h, "BAR","${FOO}");
/* FOO = "${BAR}" */
/* BAR = "${FOO}" */