[BusyBox] Re: Some more busybox issues...

Mark Whitley markw at lineo.com
Thu Mar 15 22:27:51 UTC 2001


On Thu, Mar 15, 2001 at 09:53:06PM +0100, Andreas Neuhaus wrote:

[re: linuxrc bug]

> fixed in applets.h revision 1.20

Good.


[re: uClibc string bug(s) and not seeing the alleged fixes]

> also include/string.h still contains #define index strchr... are we using
> different cvs repositories? i completely checked out uClibc again, but still
> i can't see your fixes.

I was having the same problem but then I recalled that the uClibc source on
busybox.net is a mirror of the main source on cvs.uclinux.org, mirrored once
an hour on the hour. Try doing a 'cvs up' again and you should see the
changes. I just checked them out, compiled, tested, and sure enough, ps
behaves as it should.


[re: problems with linked-list manipulation in init.c]

> pointers within the list are updated correctly, there's no problem...
> this is where delete_InitAction actually frees a. (see below)

> when deleting an element while iterating, the next element is taken from a
> freed element:
> 
> for (a=initActionList; a; a=a->nextPtr) {
>     if (whatever) {
>         // do whatever
>         delete_InitAction(a);
>     }
> }

You are indeed correct and this is (was) a problem in the way the list
elements were being accessed. I misunderstood your previous email; I thought
you were talking about a problem in delete_InitAction. My bad.

> after delete_InitAction(a) returns, a is freed. but if the loop continues,
> it'll take a->nextPtr. to prevent this, the loop should e.g. look like this:
> 
> for (a=initActionList; a; a=next) {
>     next = a->nextPtr;
>     if (whatever) {
>         // do whatever
>         delete_InitAction(a);
>     }
> }
>
> deleting while iterating is always horrible...

This is an excellent approach. You may have already seen that Erik committed
such a change to CVS.


Thanks for the good bug-sighting.


Mark Whitley
markw at lineo.com





More information about the busybox mailing list