From 0f4743651081b5367ab06f238827ddfd4da74e74 Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Thu, 22 Oct 2015 19:28:31 +0200 Subject: util-lib: get_current_dir_name() can return errors other than ENOMEM get_current_dir_name() can return a variety of errors, not just ENOMEM, hence don't blindly turn its errors to ENOMEM, but return correct errors in path_make_absolute_cwd(). This trickles down into a couple of other functions, some of which receive unrelated minor fixes too with this commit. --- src/firstboot/firstboot.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) (limited to 'src/firstboot/firstboot.c') diff --git a/src/firstboot/firstboot.c b/src/firstboot/firstboot.c index 82ebb91788..cee05de7a1 100644 --- a/src/firstboot/firstboot.c +++ b/src/firstboot/firstboot.c @@ -690,16 +690,12 @@ static int parse_argv(int argc, char *argv[]) { return version(); case ARG_ROOT: - free(arg_root); - arg_root = path_make_absolute_cwd(optarg); - if (!arg_root) - return log_oom(); + arg_root = mfree(arg_root); + r = path_make_absolute_cwd(optarg, &arg_root); + if (r < 0) + return log_error_errno(r, "Failed to make root path absolute: %m"); path_kill_slashes(arg_root); - - if (path_equal(arg_root, "/")) - arg_root = mfree(arg_root); - break; case ARG_LOCALE: -- cgit v1.2.3-54-g00ecf