summaryrefslogtreecommitdiff
path: root/src/nspawn/nspawn.c
diff options
context:
space:
mode:
authorRichard Maw <richard.maw@codethink.co.uk>2015-06-19 15:24:35 +0000
committerRichard Maw <richard.maw@codethink.co.uk>2015-08-07 15:50:43 +0000
commite4a5d9edee1d967e4c1386ce442cbe1f465766ec (patch)
tree68ffe27a42e188dcf4faf9a7358579f5fd8231ab /src/nspawn/nspawn.c
parent8adaf7bd23baa6e2cd99e9e88e55d0f5f5db29a2 (diff)
nspawn: Allow : characters in nspawn --bind paths
: characters in bind paths can be entered as the \: escape sequence.
Diffstat (limited to 'src/nspawn/nspawn.c')
-rw-r--r--src/nspawn/nspawn.c21
1 files changed, 13 insertions, 8 deletions
diff --git a/src/nspawn/nspawn.c b/src/nspawn/nspawn.c
index fe5f3528ce..b65b13426f 100644
--- a/src/nspawn/nspawn.c
+++ b/src/nspawn/nspawn.c
@@ -655,17 +655,22 @@ static int parse_argv(int argc, char *argv[]) {
case ARG_BIND:
case ARG_BIND_RO: {
+ const char *current = optarg;
_cleanup_free_ char *source = NULL, *destination = NULL;
CustomMount *m;
- char *e;
+ _cleanup_strv_free_ char **strv = NULL;
- e = strchr(optarg, ':');
- if (e) {
- source = strndup(optarg, e - optarg);
- destination = strdup(e + 1);
- } else {
- source = strdup(optarg);
- destination = strdup(optarg);
+ r = extract_many_words(&current, ":", EXTRACT_DONT_COALESCE_SEPARATORS, &source, &destination, NULL);
+ switch (r) {
+ case 1:
+ destination = strdup(source);
+ case 2:
+ break;
+ case -ENOMEM:
+ return log_oom();
+ default:
+ log_error("Invalid bind mount specification: %s", optarg);
+ return -EINVAL;
}
if (!source || !destination)