* Various bug fixes.

This commit is contained in:
Paul Smith 1999-07-16 02:25:03 +00:00
parent 9d89ad56bf
commit a3cf773e29
3 changed files with 18 additions and 4 deletions

View file

@ -1,5 +1,8 @@
1999-07-15 Paul D. Smith <psmith@gnu.org> 1999-07-15 Paul D. Smith <psmith@gnu.org>
* read.c (read_makefile): Fix some potential memory stomps parsing
`define' directives where no variable name is given.
* function.c (func_apply): Various code cleanup and tightening. * function.c (func_apply): Various code cleanup and tightening.
(function_table): Add "apply" as a valid builtin function. (function_table): Add "apply" as a valid builtin function.
@ -7,6 +10,11 @@
* NEWS: Announce it. * NEWS: Announce it.
1999-07-09 Eli Zaretskii <eliz@is.elta.co.il>
* variable.c (try_variable_definition) [__MSDOS__, WINDOWS32]:
Treat "override SHELL=" the same as just "SHELL=".
1999-07-09 Paul D. Smith <psmith@gnu.org> 1999-07-09 Paul D. Smith <psmith@gnu.org>
* job.c (start_waiting_job): Don't get a second job token if we * job.c (start_waiting_job): Don't get a second job token if we

10
read.c
View file

@ -530,6 +530,9 @@ read_makefile (filename, flags)
else else
{ {
p2 = next_token (p + 6); p2 = next_token (p + 6);
if (*p2 == '\0')
fatal (&fileinfo, "empty variable name");
/* Let the variable name be the whole rest of the line, /* Let the variable name be the whole rest of the line,
with trailing blanks stripped (comments have already been with trailing blanks stripped (comments have already been
removed), so it could be a complex variable/function removed), so it could be a complex variable/function
@ -545,7 +548,7 @@ read_makefile (filename, flags)
if (word1eq ("override", 8)) if (word1eq ("override", 8))
{ {
p2 = next_token (p + 8); p2 = next_token (p + 8);
if (p2 == 0) if (*p2 == '\0')
error (&fileinfo, "empty `override' directive"); error (&fileinfo, "empty `override' directive");
if (!strncmp (p2, "define", 6) && (isblank (p2[6]) || p2[6] == '\0')) if (!strncmp (p2, "define", 6) && (isblank (p2[6]) || p2[6] == '\0'))
{ {
@ -554,6 +557,9 @@ read_makefile (filename, flags)
else else
{ {
p2 = next_token (p2 + 6); p2 = next_token (p2 + 6);
if (*p2 == '\0')
fatal (&fileinfo, "empty variable name");
/* Let the variable name be the whole rest of the line, /* Let the variable name be the whole rest of the line,
with trailing blanks stripped (comments have already been with trailing blanks stripped (comments have already been
removed), so it could be a complex variable/function removed), so it could be a complex variable/function
@ -566,7 +572,7 @@ read_makefile (filename, flags)
} }
else if (!ignoring else if (!ignoring
&& !try_variable_definition (&fileinfo, p2, o_override)) && !try_variable_definition (&fileinfo, p2, o_override))
error (&fileinfo, "empty `override' directive"); error (&fileinfo, "invalid `override' directive");
continue; continue;
} }

View file

@ -850,7 +850,7 @@ try_variable_definition (flocp, line, origin)
you have bash.exe installed as d:/unix/bash.exe, and d:/unix is on you have bash.exe installed as d:/unix/bash.exe, and d:/unix is on
your $PATH, then SHELL=/usr/local/bin/bash will have the effect of your $PATH, then SHELL=/usr/local/bin/bash will have the effect of
defining SHELL to be "d:/unix/bash.exe". */ defining SHELL to be "d:/unix/bash.exe". */
if (origin == o_file if ((origin == o_file || origin == o_override)
&& strcmp (expanded_name, "SHELL") == 0) && strcmp (expanded_name, "SHELL") == 0)
{ {
char shellpath[PATH_MAX]; char shellpath[PATH_MAX];
@ -918,7 +918,7 @@ try_variable_definition (flocp, line, origin)
else else
#endif /* __MSDOS__ */ #endif /* __MSDOS__ */
#ifdef WINDOWS32 #ifdef WINDOWS32
if (origin == o_file if ((origin == o_file || origin == o_override)
&& strcmp (expanded_name, "SHELL") == 0) { && strcmp (expanded_name, "SHELL") == 0) {
extern char* default_shell; extern char* default_shell;