network-generator: use parse_path_argument() to avoid spurious paths
This commit is contained in:
@@ -16,6 +16,7 @@
|
||||
#include "main-func.h"
|
||||
#include "mkdir.h"
|
||||
#include "network-generator.h"
|
||||
#include "parse-argument.h"
|
||||
#include "path-util.h"
|
||||
#include "proc-cmdline.h"
|
||||
#include "string-util.h"
|
||||
@@ -24,7 +25,9 @@
|
||||
|
||||
#define NETWORK_UNIT_DIRECTORY "/run/systemd/network/"
|
||||
|
||||
static const char *arg_root = NULL;
|
||||
static char *arg_root = NULL;
|
||||
|
||||
STATIC_DESTRUCTOR_REGISTER(arg_root, freep);
|
||||
|
||||
COMMAND(
|
||||
"systemd-network-generator\0",
|
||||
@@ -159,6 +162,8 @@ static int context_save(Context *context) {
|
||||
}
|
||||
|
||||
static int parse_argv(int argc, char *argv[], char ***ret_args) {
|
||||
int r;
|
||||
|
||||
assert(argc >= 0);
|
||||
assert(argv);
|
||||
assert(ret_args);
|
||||
@@ -174,9 +179,10 @@ static int parse_argv(int argc, char *argv[], char ***ret_args) {
|
||||
OPTION_COMMON_VERSION:
|
||||
return version();
|
||||
|
||||
OPTION_LONG("root", "PATH",
|
||||
"Operate on an alternate filesystem root"):
|
||||
arg_root = opts.arg;
|
||||
OPTION_LONG("root", "PATH", "Operate on an alternate filesystem root"):
|
||||
r = parse_path_argument(opts.arg, /* suppress_root= */ true, &arg_root);
|
||||
if (r < 0)
|
||||
return r;
|
||||
break;
|
||||
|
||||
OPTION_COMMON_INTROSPECT_CLI:
|
||||
|
||||
Reference in New Issue
Block a user