summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2016-11-07 08:54:47 -0500
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2016-11-07 08:54:47 -0500
commit49fedb4094b69d279095ef8ce8d9203161aed5d9 (patch)
tree5201365f755af05589fe1f56a7f142f5e1a7c350 /src
parentf0a4feb0a5318e52107b0df63997a9b13f5be668 (diff)
nspawn: avoid one strdup by using free_and_replace
Diffstat (limited to 'src')
-rw-r--r--src/core/namespace.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/core/namespace.c b/src/core/namespace.c
index 2dae579332..c719dc13e7 100644
--- a/src/core/namespace.c
+++ b/src/core/namespace.c
@@ -678,8 +678,9 @@ static int chase_all_symlinks(const char *root_directory, BindMount *m, unsigned
* chase the symlinks on our own first. This call wil do so for all entries and remove all entries where we
* can't resolve the path, and which have been marked for such removal. */
- for (f = m, t = m; f < m+*n; f++) {
+ for (f = m, t = m; f < m + *n; f++) {
_cleanup_free_ char *chased = NULL;
+
r = chase_symlinks(f->path, root_directory, &chased);
if (r == -ENOENT && f->ignore) {
/* Doesn't exist? Then remove it! */
@@ -691,7 +692,7 @@ static int chase_all_symlinks(const char *root_directory, BindMount *m, unsigned
if (!path_equal(f->path, chased)) {
log_debug("Chased %s → %s", f->path, chased);
- r = free_and_strdup(&f->path, chased);
+ r = free_and_replace(f->path, chased);
if (r < 0)
return r;
}