svn commit: trunk/busybox: include util-linux

Rob Landley rob at landley.net
Tue Dec 13 09:22:08 UTC 2005


On Tuesday 13 December 2005 02:55, Vladimir N. Oleynik wrote:
> Its have bug:

I'm not at all surprised, it's a first cut.  ("Worked in testing once.")

> if second entry->d_type is shotred,

Do you mean shortened?

It doesn't get shortened.

> this make rubbish path  
> variable after return from recursion.

Um, how?

len is calculated once (outside of the loop), and I sprintf at path+len and 
the set path[len]=0 to chop it back.  The recursive call only extends path, 
it never truncates it.  (The return path is what truncates it, back to where 
it was when it was called.)

I thought about this.  Really I did.  I may have gotten it wrong, but if so I 
don't currently see it.

> Please use libbb/concat_subpath_file()

Which is a wrapper around a wrapper around bb_asprintf(), meaning it mallocs() 
a new string that we'll have to free each time, and stacks them up to the 
depth of the call tree.

The whole point of the trick I'm doing re-using the buffer that, well, I'm 
re-using the same buffer.  (I don't even really have to pass it in the 
function argument, it could be a global.)

Rob
-- 
Steve Ballmer: Innovation!  Inigo Montoya: You keep using that word.
I do not think it means what you think it means.



More information about the busybox mailing list