1
0
mirror of https://github.com/systemd/systemd.git synced 2025-03-21 02:50:18 +03:00

nspawn: Allow : characters in --tmpfs path

This now accepts : characters with the \: escape sequence.

Other escape sequences are also interpreted, but having a \ in your file
path is less likely than :, so this shouldn't break anyone's existing
tools.
This commit is contained in:
Richard Maw 2015-06-19 15:24:31 +00:00
parent 206644aede
commit 6330ee1083

View File

@ -690,18 +690,21 @@ static int parse_argv(int argc, char *argv[]) {
}
case ARG_TMPFS: {
const char *current = optarg;
_cleanup_free_ char *path = NULL, *opts = NULL;
CustomMount *m;
char *e;
e = strchr(optarg, ':');
if (e) {
path = strndup(optarg, e - optarg);
opts = strdup(e + 1);
} else {
path = strdup(optarg);
opts = strdup("mode=0755");
r = extract_first_word(&current, &path, ":", EXTRACT_DONT_COALESCE_SEPARATORS);
if (r == -ENOMEM)
return log_oom();
else if (r < 0) {
log_error("Invalid tmpfs specification: %s", optarg);
return r;
}
if (r)
opts = strdup(current);
else
opts = strdup("mode=0755");
if (!path || !opts)
return log_oom();