summaryrefslogtreecommitdiff
path: root/main.c
diff options
context:
space:
mode:
authorPaul Smith <psmith@gnu.org>2005-06-25 20:00:24 +0000
committerPaul Smith <psmith@gnu.org>2005-06-25 20:00:24 +0000
commit1dd9ed1c0537cb2583e1de8367994560ad1470aa (patch)
treeb30f0c7714fdf3d7450cf4ddca8a485572ff7631 /main.c
parent978819e1d6e9354b5b20d15c875bef98579873ae (diff)
downloadgunmake-1dd9ed1c0537cb2583e1de8367994560ad1470aa.tar.gz
Fix -W foo yielding infinite recursion in some cases of re-exec.
Added a -W test suite.
Diffstat (limited to 'main.c')
-rw-r--r--main.c18
1 files changed, 14 insertions, 4 deletions
diff --git a/main.c b/main.c
index 0be958d..cd58a49 100644
--- a/main.c
+++ b/main.c
@@ -1772,9 +1772,9 @@ main (int argc, char **argv, char **envp)
build_vpath_lists ();
- /* Mark files given with -o flags as very old
- and as having been updated already, and files given with -W flags as
- brand new (time-stamp as far as possible into the future). */
+ /* Mark files given with -o flags as very old and as having been updated
+ already, and files given with -W flags as brand new (time-stamp as far
+ as possible into the future). If restarts is set we'll do -W later. */
if (old_files != 0)
for (p = old_files->list; *p != 0; ++p)
@@ -1786,7 +1786,7 @@ main (int argc, char **argv, char **envp)
f->command_state = cs_finished;
}
- if (new_files != 0)
+ if (!restarts && new_files != 0)
{
for (p = new_files->list; *p != 0; ++p)
{
@@ -2117,6 +2117,16 @@ main (int argc, char **argv, char **envp)
/* Set always_make_flag if -B was given. */
always_make_flag = always_make_set;
+ /* If restarts is set we haven't set up -W files yet, so do that now. */
+ if (restarts && new_files != 0)
+ {
+ for (p = new_files->list; *p != 0; ++p)
+ {
+ f = enter_command_line_file (*p);
+ f->last_mtime = f->mtime_before_update = NEW_MTIME;
+ }
+ }
+
/* If there is a temp file from reading a makefile from stdin, get rid of
it now. */
if (stdin_nm && unlink (stdin_nm) < 0 && errno != ENOENT)