[PATCH] smemcap: keep outputting by ignoring transient processes

Denys Vlasenko vda.linux at googlemail.com
Thu Aug 30 09:53:01 UTC 2018


On Sun, Aug 26, 2018 at 11:21 PM Xabier Oneca -- xOneca
<xoneca at gmail.com> wrote:
>
> Hello Denys,
>
> > Applied, thanks
>
> The applied patch
> (https://git.busybox.net/busybox/commit/?id=9a2621a3b9243919921935f0e3eff6d942379e77)
> is not the same as the one posted.

                cur = xzalloc(sizeof(*cur));
                *prev = cur;
                prev = &cur->next;
                r = full_read(fd, cur->data, TAR_BLOCK_SIZE);
-               if (r > 0)
+               if (r > 0) {
                        size += r;
+               } else if (r == -1) {
+                       close(fd);
+                       return;
+               }

This part is leaking allocated memory. Instead of fixing it,
Instead of fixing it, I decided that code looks like it'll work
without this change. Do you find it not working properly
without this change? What is the failure mode?

> Also, doesn't xopen print an error and exit imediately if fd < 0? if
> so, your applied patch does nothing.

Oops... fixed that.


More information about the busybox mailing list