diff options
author | Lennart Poettering <lennart@poettering.net> | 2015-10-22 19:28:31 +0200 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2015-10-24 23:03:49 +0200 |
commit | 0f4743651081b5367ab06f238827ddfd4da74e74 (patch) | |
tree | 43b072e7eb30af4c4c80fa451768ecd8eb14a1d9 /src/tmpfiles | |
parent | 85eca92e2061043d733991b386d8dc10fad0fc30 (diff) |
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.
Diffstat (limited to 'src/tmpfiles')
-rw-r--r-- | src/tmpfiles/tmpfiles.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/tmpfiles/tmpfiles.c b/src/tmpfiles/tmpfiles.c index 09b6ca5c2c..693a3da2f4 100644 --- a/src/tmpfiles/tmpfiles.c +++ b/src/tmpfiles/tmpfiles.c @@ -2101,7 +2101,7 @@ static int parse_argv(int argc, char *argv[]) { {} }; - int c; + int c, r; assert(argc >= 0); assert(argv); @@ -2144,10 +2144,10 @@ static int parse_argv(int argc, char *argv[]) { break; 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); break; |