[Pkg-sysvinit-devel] Bug#537182: Bug#537182: leftover startpar process after makefile concurrency boot

Iain Calder ic56 at rogers.com
Thu Jul 16 05:45:00 UTC 2009


> This is the hanging code:
> 
> void do_forward(void)
> {
>   char buf[4096], *b;
>   int r, rr;
>   setsid();
>   while ((r = read(0, buf, sizeof(buf))) > 0)
>     {
>       b = buf;
>       while (r > 0)
>         {
>           rr = write(1, b, r);
>           if (rr == -1)
>             {
>               perror("write");
>               rr = r;
>             }
>           r -= rr;
>         }
>     }
>   _exit(0);
> }

Sorry to barge in, I really know nothing about this code or
the bug.  But it seems to me that this code should augment b.
Otherwise this code can behave as an infinite loop.
I.e. it should be:

              }
            r -= rr;
+           b += rr;
          }

Perhaps that is the cause of the problem?

-ic
--
Iain Calder  <ic56 at rogers.com>  Toronto, Canada





More information about the Pkg-sysvinit-devel mailing list