From: Peter Johnson Date: Sat, 20 Jan 2007 05:52:32 +0000 (-0000) Subject: Fix bug in [1737]. Using a valid environment variable after a non-existent X-Git-Tag: v0.6.0~49 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=d2fba0ea6eb349db3e3d5f0bced3ff72aa18abc7;p=yasm Fix bug in [1737]. Using a valid environment variable after a non-existent one would result in the part of the string prior to the non-existent one getting dropped. svn path=/trunk/yasm/; revision=1738 --- diff --git a/modules/preprocs/nasm/nasm-pp.c b/modules/preprocs/nasm/nasm-pp.c index b643a9f9..c1ca6a80 100644 --- a/modules/preprocs/nasm/nasm-pp.c +++ b/modules/preprocs/nasm/nasm-pp.c @@ -1296,9 +1296,9 @@ inc_fopen(char *file, char **newname) * intact, if ENVVAR is not set in the environment. */ pb = file; + p1 = pb; for (;;) { char *env; - p1 = pb; while (*p1 != '\0' && *p1 != '%') p1++; if (*p1 == '\0') @@ -1318,7 +1318,7 @@ inc_fopen(char *file, char **newname) error(ERR_WARNING, "environment variable `%s' does not exist", p1+1); *p2 = '%'; - pb = p2+1; + p1 = p2+1; continue; } /* need to expand */ @@ -1331,6 +1331,7 @@ inc_fopen(char *file, char **newname) strcat(file2, pb); strcat(file2, env); pb = p2+1; + p1 = pb; } /* add tail end; string is long enough that we don't need to realloc */ if (file2)