[Toybox] [PATCH] cpio: add -d

Rob Landley rob at landley.net
Sat Feb 22 15:56:30 PST 2014


I'm behind on email again.

On 01/26/14 01:16, Isaac Dunham wrote:
> Support cpio -d.
> cpio -d is similar in logic to mkdir -p, so split out the relevant code.

"mkpath" seems a more obvious name for the -p version of mkdir, and it
should go in lib.c, except that you broke mkdir -pm.

You kept the comment "Use the mode from the -m option only for the last
directory." but your modified code isn't doing it, it's passing in a
single mode and using it for every directory in the path instead of
using different ones for save == '/' and else cases. (You removed the
else case, meaning if the last directory isn't writeable the path
creation aborts after the first directory.)

Also, C functions most often return 0 for success and nonzero on error.

> r_mkdir should probably go in one or another of the headers, and
> r_mkdir.c should go in pending.c or lib.c; but I wasn't sure how to
> proceed on that front.

lib/pending.c is for stuff that doesn't affect anything outside of
toys/pending. Unfortunately, this affects a previously stable command,
mkdir, so I need to fix it before I can merge it.

(This was the reason for the delay. That and writing my own inflate
implementation, which is in now.)

I'll see if I can take a stab at it this evening...

Rob



More information about the Toybox mailing list