[PATCH] ls: clean up

Shaun Jackman sjackman at gmail.com
Fri Apr 28 14:07:51 UTC 2006


On 4/28/06, Vladimir N. Oleynik <dzo at simtreas.ru> wrote:
> > -#include <stdio.h>
>
> ???

stdio.h is mistakenly included twice.

> I moved outside for(...)

Sounds good to me.

> also, found memory leak one again:
> showdirs() must call dfree(subdnp, nfiles) always,
> not if CONFIG_FEATURE_LS_RECURSIVE only.

I guess the thinking was probably that if ls isn't recursive, there's
no need to clean up memory explicitly, since ls will be exiting soon
enough. Even without recursive listing, if the argument list were long
enough and each argument was a directory, it might be possible to
exhaust memory.

Comments anyone?

> But I do not support ENABLE_FEATURE_CLEAN_UP ;-)

FEATURE_CLEAN_UP has its purpose. It's very useful with dmalloc to
ensure the system is leak-free, and as a nice side effect its useful
to support a system where busybox isn't forking and exiting with every
command.

> Your changes vfork() to setjmp very very strange for me.
> Have you a platform without vfork()? Have it linux ported?

Yes, I have a small newlib/libgloss based system without vfork. It's
an ARM7 (Atmel AT91). uClinux has been ported to it, but the
constraints are tight: 1 MB SRAM and 2 MB flash. I think it would be
possible to run uClinux on this system -- I have seen the kernel
start, at the least -- but there wouldn't be much room left for the
application.

Cheers,
Shaun


More information about the busybox mailing list