mk: avoid infinite loop when targets are repeated
Fixes "mk -f /tmp/x.mk y x" or "mk -f /tmp/x.mk" where /tmp/x.mk is: x y x: f echo hi Change-Id: I7fa87dc4750c04fdba010b990c190722b432b333 Reviewed-on: https://plan9port-review.googlesource.com/1361 Reviewed-by: Russ Cox <rsc@swtch.com>
This commit is contained in:
parent
775cb933ec
commit
44eb208829
2 changed files with 6 additions and 0 deletions
|
|
@ -109,6 +109,7 @@ typedef struct Node
|
||||||
#define NORECIPE 0x0400
|
#define NORECIPE 0x0400
|
||||||
#define DELETE 0x0800
|
#define DELETE 0x0800
|
||||||
#define NOMINUSE 0x1000
|
#define NOMINUSE 0x1000
|
||||||
|
#define ONLIST 0x2000
|
||||||
|
|
||||||
typedef struct Job
|
typedef struct Job
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -70,10 +70,15 @@ dorecipe(Node *node)
|
||||||
ww->next = newword(buf);
|
ww->next = newword(buf);
|
||||||
ww = ww->next;
|
ww = ww->next;
|
||||||
if(n == node) continue;
|
if(n == node) continue;
|
||||||
|
if((n->flags&ONLIST) != 0)
|
||||||
|
continue;
|
||||||
|
n->flags |= ONLIST;
|
||||||
n->next = node->next;
|
n->next = node->next;
|
||||||
node->next = n;
|
node->next = n;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
for(n = node->next; n; n = n->next)
|
||||||
|
n->flags &= ~ONLIST;
|
||||||
for(n = node; n; n = n->next)
|
for(n = node; n; n = n->next)
|
||||||
if((n->flags&READY) == 0)
|
if((n->flags&READY) == 0)
|
||||||
return(did);
|
return(did);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue