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
0.6.0
Peter Johnson 18 years ago
parent 7a18cdaf3c
commit d2fba0ea6e
  1. 5
      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)

Loading…
Cancel
Save