URI: 
       tmk: avoid infinite loop when targets are repeated - plan9port - [fork] Plan 9 from user space
  HTML git clone git://src.adamsgaard.dk/plan9port
   DIR Log
   DIR Files
   DIR Refs
   DIR README
   DIR LICENSE
       ---
   DIR commit 44eb2088299f10d45a1b3950285c3314217e0f44
   DIR parent 775cb933ecea6361717ef1def27b5d9e90c385fd
  HTML Author: Russ Cox <rsc@swtch.com>
       Date:   Tue, 25 Aug 2015 15:59:43 -0400
       
       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>
       
       Diffstat:
         M src/cmd/mk/mk.h                     |       1 +
         M src/cmd/mk/recipe.c                 |       5 +++++
       
       2 files changed, 6 insertions(+), 0 deletions(-)
       ---
   DIR diff --git a/src/cmd/mk/mk.h b/src/cmd/mk/mk.h
       t@@ -109,6 +109,7 @@ typedef struct Node
        #define                NORECIPE        0x0400
        #define                DELETE                0x0800
        #define                NOMINUSE        0x1000
       +#define                ONLIST                0x2000
        
        typedef struct Job
        {
   DIR diff --git a/src/cmd/mk/recipe.c b/src/cmd/mk/recipe.c
       t@@ -70,10 +70,15 @@ dorecipe(Node *node)
                                ww->next = newword(buf);
                                ww = ww->next;
                                if(n == node) continue;
       +                        if((n->flags&ONLIST) != 0)
       +                                continue;
       +                        n->flags |= ONLIST;
                                n->next = node->next;
                                node->next = n;
                        }
                }
       +        for(n = node->next; n; n = n->next)
       +                n->flags &= ~ONLIST;
                for(n = node; n; n = n->next)
                        if((n->flags&READY) == 0)
                                return(did);