diff options
author | Lennart Poettering <lennart@poettering.net> | 2015-10-22 19:54:29 +0200 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2015-10-24 23:03:49 +0200 |
commit | 0f03c2a4c093e3d44f4072144827e943c05c8904 (patch) | |
tree | 70232d1b14b4dfcd82983894d13963e2ca9f4fec /src/systemctl | |
parent | 0f4743651081b5367ab06f238827ddfd4da74e74 (diff) |
path-util: unify how we process paths specified on the command line
Let's introduce a common function that makes relative paths absolute and
warns about any errors while doing so.
Diffstat (limited to 'src/systemctl')
-rw-r--r-- | src/systemctl/systemctl.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/src/systemctl/systemctl.c b/src/systemctl/systemctl.c index b99c64a75a..dbf9f600c0 100644 --- a/src/systemctl/systemctl.c +++ b/src/systemctl/systemctl.c @@ -107,7 +107,7 @@ static UnitFilePresetMode arg_preset_mode = UNIT_FILE_PRESET_FULL; static char **arg_wall = NULL; static const char *arg_kill_who = NULL; static int arg_signal = SIGTERM; -static const char *arg_root = NULL; +static char *arg_root = NULL; static usec_t arg_when = 0; static enum action { _ACTION_INVALID, @@ -6612,7 +6612,7 @@ static int systemctl_parse_argv(int argc, char *argv[]) { {} }; - int c; + int c, r; assert(argc >= 0); assert(argv); @@ -6769,7 +6769,9 @@ static int systemctl_parse_argv(int argc, char *argv[]) { break; case ARG_ROOT: - arg_root = optarg; + r = parse_path_argument_and_warn(optarg, true, &arg_root); + if (r < 0) + return r; break; case 'l': @@ -7778,6 +7780,7 @@ finish: strv_free(arg_properties); strv_free(arg_wall); + free(arg_root); release_busses(); |