diff options
Diffstat (limited to 'usr.bin')
-rw-r--r-- | usr.bin/make/var.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/usr.bin/make/var.c b/usr.bin/make/var.c index bd9ade8..fb7ae0f 100644 --- a/usr.bin/make/var.c +++ b/usr.bin/make/var.c @@ -1006,6 +1006,8 @@ VarParseLong(char foo[], GNode *ctxt, Boolean err, size_t *lengthPtr, } } + dynamic = FALSE; + if (v == NULL) { if (((ctxt == VAR_CMD) || (ctxt == VAR_GLOBAL)) && ((vlen == 1) || @@ -1079,8 +1081,6 @@ VarParseLong(char foo[], GNode *ctxt, Boolean err, size_t *lengthPtr, return (err ? var_Error : varNoError); } } - } else { - dynamic = FALSE; } Buf_Destroy(buf, TRUE); @@ -1634,7 +1634,6 @@ VarParseLong(char foo[], GNode *ctxt, Boolean err, size_t *lengthPtr, tstr = cp; } } - *lengthPtr = tstr - input + 1; if (v->flags & VAR_FROM_ENV) { if (rw_str == (char *)Buf_GetAll(v->val, (size_t *)NULL)) { @@ -1643,9 +1642,11 @@ VarParseLong(char foo[], GNode *ctxt, Boolean err, size_t *lengthPtr, * the thing. */ *freePtr = TRUE; + *lengthPtr = tstr - input + 1; VarDestroy(v, FALSE); return (rw_str); } else { + *lengthPtr = tstr - input + 1; VarDestroy(v, TRUE); return (rw_str); } @@ -1659,6 +1660,7 @@ VarParseLong(char foo[], GNode *ctxt, Boolean err, size_t *lengthPtr, } if (dynamic) { *freePtr = FALSE; + *lengthPtr = tstr - input + 1; VarDestroy(v, TRUE); rw_str = emalloc(*lengthPtr + 1); strncpy(rw_str, input, *lengthPtr); @@ -1667,10 +1669,12 @@ VarParseLong(char foo[], GNode *ctxt, Boolean err, size_t *lengthPtr, return (rw_str); } else { *freePtr = FALSE; + *lengthPtr = tstr - input + 1; VarDestroy(v, TRUE); return (err ? var_Error : varNoError); } } else { + *lengthPtr = tstr - input + 1; return (rw_str); } } |