X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=src%2Fsrc%2Fexpand.c;h=c13284d8e78925c4053ef959ee62a700e2b8e209;hb=20fcb1e7be45177beca2d433f54260843cc7c2f6;hp=0fba962781807b8c6e221f932d788410e5dda468;hpb=44bc8f0c2f3576b46bd6df1b818cb29eaf84df5b;p=user%2Fhenk%2Fcode%2Fexim.git diff --git a/src/src/expand.c b/src/src/expand.c index 0fba96278..c13284d8e 100644 --- a/src/src/expand.c +++ b/src/src/expand.c @@ -3189,16 +3189,17 @@ items. */ while (isspace(*s)) s++; if (*s == '}') { - if (type[0] == 'i') - { - if (yes) *yieldptr = string_catn(*yieldptr, sizeptr, ptrptr, US"true", 4); - } - else - { - if (yes && lookup_value) - *yieldptr = string_cat(*yieldptr, sizeptr, ptrptr, lookup_value); - lookup_value = save_lookup; - } + if (!skipping) + if (type[0] == 'i') + { + if (yes) *yieldptr = string_catn(*yieldptr, sizeptr, ptrptr, US"true", 4); + } + else + { + if (yes && lookup_value) + *yieldptr = string_cat(*yieldptr, sizeptr, ptrptr, lookup_value); + lookup_value = save_lookup; + } s++; goto RETURN; } @@ -3495,7 +3496,6 @@ Returns: new value of string pointer static uschar * cat_file(FILE *f, uschar *yield, int *sizep, int *ptrp, uschar *eol) { -int eollen = eol ? Ustrlen(eol) : 0; uschar buffer[1024]; while (Ufgets(buffer, sizeof(buffer), f)) @@ -3503,8 +3503,8 @@ while (Ufgets(buffer, sizeof(buffer), f)) int len = Ustrlen(buffer); if (eol && buffer[len-1] == '\n') len--; yield = string_catn(yield, sizep, ptrp, buffer, len); - if (buffer[len] != 0) - yield = string_catn(yield, sizep, ptrp, eol, eollen); + if (eol && buffer[len]) + yield = string_cat(yield, sizep, ptrp, eol); } if (yield) yield[*ptrp] = 0; @@ -4960,7 +4960,10 @@ while (*s != 0) } if (skipping) /* Just pretend it worked when we're skipping */ + { runrc = 0; + lookup_value = NULL; + } else { if (!transport_set_up_command(&argv, /* anchor for arg list */ @@ -5002,9 +5005,9 @@ while (*s != 0) return code for serious disasters. Simple non-zero returns are passed on. */ - if (sigalrm_seen == TRUE || (runrc = child_close(pid, 30)) < 0) + if (sigalrm_seen || (runrc = child_close(pid, 30)) < 0) { - if (sigalrm_seen == TRUE || runrc == -256) + if (sigalrm_seen || runrc == -256) { expand_string_message = string_sprintf("command timed out"); killpg(pid, SIGKILL); /* Kill the whole process group */ @@ -7408,8 +7411,7 @@ while (*s != 0) yield = NULL; size = 0; } - value = find_variable(name, FALSE, skipping, &newsize); - if (value == NULL) + if (!(value = find_variable(name, FALSE, skipping, &newsize))) { expand_string_message = string_sprintf("unknown variable in \"${%s}\"", name); @@ -7417,13 +7419,14 @@ while (*s != 0) goto EXPAND_FAILED; } len = Ustrlen(value); - if (yield == NULL && newsize != 0) + if (!yield && newsize) { yield = value; size = newsize; ptr = len; } - else yield = string_catn(yield, &size, &ptr, value, len); + else + yield = string_catn(yield, &size, &ptr, value, len); continue; }