diff options
author | Richard Maw <richard.maw@codethink.co.uk> | 2015-06-19 15:24:31 +0000 |
---|---|---|
committer | Richard Maw <richard.maw@codethink.co.uk> | 2015-08-07 15:50:42 +0000 |
commit | 6330ee108362a419dfc8806ab6402416c793a4ca (patch) | |
tree | 22283a269a3d8835d7cf0e25a61272fb27a7702b /src/nspawn | |
parent | 206644aedeb8859801051ac170ec562c6a113a79 (diff) |
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.
Diffstat (limited to 'src/nspawn')
-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 0e74f20f1a..fe5f3528ce 100644 --- a/src/nspawn/nspawn.c +++ b/src/nspawn/nspawn.c @@ -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(¤t, &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(); |