nspawn: mangle slice name
It's user-facing, parsed from the command line and we typically mangle in these cases, let's do so here too. (In particular as the identical switch for systemd-run already does it.)
This commit is contained in:
parent
df957acc66
commit
43c3fb4680
|
@ -103,6 +103,7 @@
|
|||
#include "terminal-util.h"
|
||||
#include "tmpfile-util.h"
|
||||
#include "umask-util.h"
|
||||
#include "unit-name.h"
|
||||
#include "user-util.h"
|
||||
#include "util.h"
|
||||
|
||||
|
@ -891,13 +892,17 @@ static int parse_argv(int argc, char *argv[]) {
|
|||
arg_settings_mask |= SETTING_MACHINE_ID;
|
||||
break;
|
||||
|
||||
case 'S':
|
||||
r = free_and_strdup(&arg_slice, optarg);
|
||||
case 'S': {
|
||||
_cleanup_free_ char *mangled = NULL;
|
||||
|
||||
r = unit_name_mangle_with_suffix(optarg, NULL, UNIT_NAME_MANGLE_WARN, ".slice", &mangled);
|
||||
if (r < 0)
|
||||
return log_oom();
|
||||
|
||||
free_and_replace(arg_slice, mangled);
|
||||
arg_settings_mask |= SETTING_SLICE;
|
||||
break;
|
||||
}
|
||||
|
||||
case 'M':
|
||||
if (isempty(optarg))
|
||||
|
|
Loading…
Reference in a new issue