diff options
author | Richard Maw <richard.maw@codethink.co.uk> | 2015-05-22 12:58:51 +0000 |
---|---|---|
committer | Richard Maw <richard.maw@gmail.com> | 2015-05-27 14:02:51 +0000 |
commit | 5bbcd873fe3e0655aff9106a7481b56890d2840a (patch) | |
tree | aa2d9fc6d3bb3c5098b78f5713836da71e3d42c5 | |
parent | b44cca89a125c39654cc073718e129dacb36072a (diff) | |
download | systemd-5bbcd873fe3e0655aff9106a7481b56890d2840a.tar.gz |
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.
-rw-r--r-- | src/nspawn/nspawn.c | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/src/nspawn/nspawn.c b/src/nspawn/nspawn.c index 23bb959171..97f980fae8 100644 --- a/src/nspawn/nspawn.c +++ b/src/nspawn/nspawn.c @@ -687,18 +687,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 = unescape_first_word(¤t, &path, ":", UNQUOTE_SEPARATOR_SPLIT); + 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(); |