subtitle: hard linking, chan style.

if you do the chan switcheroo,
you must close the orphan, too.

; diffy -c devproc.c
/n/dump/2011/0117/sys/src/9/port/devproc.c:387,392 - devproc.c:387,393
                tc->offset = 0;
                qunlock(&p->debug);
                poperror();
+               cclose(c);
                return tc;
  
        case Qproc:
/n/dump/2011/0117/sys/src/9/port/devproc.c:1183,1190 - devproc.c:1184,1193
                error(Eprocdied);
        }
  
-       if(p->pid != PID(c->qid))
+       if(p->pid != PID(c->qid)){
+               cclose(tc);
                error(Eprocdied);
+       }
  
        unlock(i);
        poperror();

it's interesting that the naïve expectation is uniformly
that /proc/$pid/text refers to the image cache, not the
original opened channel.

- erik

Reply via email to