From 7583859ba84b2542351810ba89adf806b0cfab10 Mon Sep 17 00:00:00 2001 From: Mike Yuan Date: Wed, 4 Sep 2024 15:28:45 +0200 Subject: [PATCH] core/exec-invoke: use bind_mount_add() where appropriate --- src/core/exec-invoke.c | 20 +++----------------- 1 file changed, 3 insertions(+), 17 deletions(-) diff --git a/src/core/exec-invoke.c b/src/core/exec-invoke.c index af5552379e..f15b73d050 100644 --- a/src/core/exec-invoke.c +++ b/src/core/exec-invoke.c @@ -2641,23 +2641,9 @@ static int compile_bind_mounts( return -ENOMEM; FOREACH_ARRAY(item, context->bind_mounts, context->n_bind_mounts) { - _cleanup_free_ char *s = NULL, *d = NULL; - - s = strdup(item->source); - if (!s) - return -ENOMEM; - - d = strdup(item->destination); - if (!d) - return -ENOMEM; - - bind_mounts[h++] = (BindMount) { - .source = TAKE_PTR(s), - .destination = TAKE_PTR(d), - .read_only = item->read_only, - .recursive = item->recursive, - .ignore_enoent = item->ignore_enoent, - }; + r = bind_mount_add(&bind_mounts, &h, item); + if (r < 0) + return r; } for (ExecDirectoryType t = 0; t < _EXEC_DIRECTORY_TYPE_MAX; t++) { -- 2.25.1