[BusyBox] Re: ifconfig: Clean up. [PATCH]

Rob Landley rob at landley.net
Tue Jul 26 19:49:35 MDT 2005


On Tuesday 26 July 2005 10:53, Paul Fox wrote:
>  > > > +     if (CONFIG_FEATURE_CLEAN_UP) close(sockfd);
>  > > >       return goterr;
>  > > >  }
>  > >
>  > > What is this supposed to accomplish, besides inflating the binary for
>  > > no reason?
>  >
>  > If CLEAN_UP is undefined, it shouldn't affect the binary size at all.
>  > If CLEAN_UP is defined, it cleans up the resources the applet has
>  > allocated, namely file descriptors in this case.
>
> and why do we care about closing file descriptors?
>
> perhaps i should just ask the bigger question:  when would one use
> CONFIG_FEATURE_CLEAN_UP?  why?  is there a busybox configuration where
> exit-time leaks are an issue?

A) valgrind.

B) I don't trust systems that need vfork() instead of fork() to handle exit() 
cleanup properly.  YMMV.

C) Sometimes we want code to be reentrant.  Having code that is not reentrant 
has caused us problems before (the standalone shell code, the gzip multiple 
arguments bug...)

Rob


More information about the busybox mailing list