From c26510295fc0c2a40bd946b683cbdec16640dd1f Mon Sep 17 00:00:00 2001 From: Alexander Larsson Date: Mon, 5 Oct 2015 11:24:40 +0200 Subject: [PATCH] helper: Also copy extra symlinks from / --- lib/xdg-app-helper.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/lib/xdg-app-helper.c b/lib/xdg-app-helper.c index c89cbf23..4963d6f2 100644 --- a/lib/xdg-app-helper.c +++ b/lib/xdg-app-helper.c @@ -1496,6 +1496,20 @@ mount_extra_root_dirs (int readonly) if (bind_mount (path, dirent->d_name, BIND_RECURSIVE | (readonly ? BIND_READONLY : 0))) die_with_error ("mount root subdir %s", dirent->d_name); } + else if (S_ISLNK(st.st_mode)) + { + ssize_t r; + char *target; + + target = xmalloc (st.st_size + 1); + r = readlink (path, target, st.st_size); + if (r == -1) + die_with_error ("readlink %s", path); + target[r] = 0; + + if (symlink (target, dirent->d_name) != 0) + die_with_error ("symlink %s %s", target, dirent->d_name); + } free (path); }