[Toybox] mkpathat() behavior

Isaac Dunham ibid.ag at gmail.com
Wed May 7 07:20:02 PDT 2014


On Wed, May 07, 2014 at 03:22:11PM +0530, Ashwini Sharma wrote:
> Hi Rob, list,
> 
> __mkpathat()__ function doesn't create the last component in the given path
> if (flags & 1) == 0, e.g. input path is "a/b/c" and flags = 2, then __a__
> and __b__
> are created but __c__ isn't.
> 
> Is it expecting the filename also in the path component, to make the path
> recursively.
> I guess it shouldn't otherwise it defies the purpose of mkpathat().

The point of mkpathat is to recurively make a path; it is used for both
cpio (to implement behavior equivalent to -d) and mkdir -r.
My understanding is that it simplifies usage if the full path
specification can be passed in, since otherwise we would need to copy
the path specification and duly null-terminate it.
mkpathat cannot assume that the last entry is a directory, since cpio
could pass it a path to a file.

Treat flags similar to the flags parameter in open(); it may be built by
OR'ing relevant numbers.
> 
> regards,
> Ashwini

HTH,
Iaac Dunham

 1399472402.0


More information about the Toybox mailing list