cpiod: exit early when can't create directories

The current cpiod prints a message, but doesn't stop immediately, if it
can't create a directory needed to hold an extracted file or directory.
Unfortunately, when add_dir() or add_file() fails, our current code does not
know how to skip it, so continuing is pointless and confusing (what will
follow will be a "bad magic" error, as our cpio parser tries to parse
the unskipped file content as a new header).

So when mkdir fails, we should throw an exception instead of continuing,
so the user will see the right error and not the silly "bad magic" error.

Signed-off-by: Nadav Har'El <nyh@cloudius-systems.com>
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
cpiod: create implicit directories with default permissions

In dir_add(), we created parent directories with the same permissions
as the leaf directory. This will fail if the intent is to create a non-
writable directory.

Instead what we need to do is to always create the parent directories
with default permissions (if different permissions are intended, the
parents should appear separately in the archive), and the mode just
needs to control the leaf file or directory.

Moreover, there is really no reason to do any of this with umask().
Just using chmod() is clearer and makes sure only the intended file
has the intended permissions.

Signed-off-by: Nadav Har'El <nyh@cloudius-systems.com>
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>