: characters in bind paths can be entered as the \: escape sequence.
---
src/nspawn/nspawn.c | 29 +++++++++++++++++++++--------
1 file changed, 21 insertions(+), 8 deletions(-)
diff --git a/src/nspawn/nspawn.c b/src/nspawn/nspawn.c
index 97f980f..c40d50f 100644
--- a/src/nspawn/nspawn.c
+++ b/src/nspawn/nspawn.c
@@ -654,15 +654,28 @@ static int parse_argv(int argc, char *argv[]) {
case ARG_BIND_RO: {
_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 = strv_split_escaped(&strv, optarg, ":",
UNQUOTE_SEPARATOR_SPLIT);
+ if (r == -ENOMEM)
+ return log_oom();
+ else if (r < 0) {
+ log_error("Invalid bind mount specification:
%s", optarg);
+ return r;
+ }
+
+ switch (strv_length(strv)) {
+ case 1:
+ source = strdup(strv[0]);
+ destination = strdup(strv[0]);
+ break;
+ case 2:
+ source = strdup(strv[0]);
+ destination = strdup(strv[1]);
+ break;
+ default:
+ log_error("Invalid bind mount specification:
%s", optarg);
+ return -EINVAL;
}
if (!source || !destination)
--
1.9.1
_______________________________________________
systemd-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/systemd-devel