[systemd-devel] [PATCH] nspawn: Give a more helpful error message when -D argument is bogus.
Lennart Poettering
lennart at poettering.net
Mon Nov 25 18:52:38 PST 2013
On Mon, 25.11.13 16:01, Shawn Landden (shawn at churchofgit.com) wrote:
> ---
> src/nspawn/nspawn.c | 5 +++++
> 1 file changed, 5 insertions(+)
>
> diff --git a/src/nspawn/nspawn.c b/src/nspawn/nspawn.c
> index 0973a00..1ee4ab3 100644
> --- a/src/nspawn/nspawn.c
> +++ b/src/nspawn/nspawn.c
> @@ -200,6 +200,11 @@ static int parse_argv(int argc, char *argv[]) {
>
> case 'D':
> free(arg_directory);
> + if (access(optarg, F_OK) < 0) {
> + log_error("Root directory %s is not accessable: %m", optarg);
> + return -EACCES;
> + }
> +
> arg_directory =
> canonicalize_file_name(optarg);
canonicalize_file_name() generates an error if the specified path cannot
be resolved. I now made sure the error message shown incorporates that
error to indicate more clearly what is going on. That should suffice to
make the error more helpful.
Lennart
--
Lennart Poettering, Red Hat
More information about the systemd-devel
mailing list