return 0;
}
+static int chase_symlinks_and_update(char **p) {
+ char *chased;
+ int r;
+
+ assert(p);
+
+ if (!*p)
+ return 0;
+
+ r = chase_symlinks(*p, NULL, &chased);
+ if (r < 0)
+ return log_error_errno(r, "Failed to resolve path %s: %m", *p);
+
+ free(*p);
+ *p = chased;
+
+ return 0;
+}
+
static int determine_uid_shift(const char *directory) {
int r;
if (arg_ephemeral) {
_cleanup_free_ char *np = NULL;
+ r = chase_symlinks_and_update(&arg_directory);
+ if (r < 0)
+ goto finish;
+
/* If the specified path is a mount point we
* generate the new snapshot immediately
* inside it under a random name. However if
}
if (arg_template) {
+ r = chase_symlinks_and_update(&arg_template);
+ if (r < 0)
+ goto finish;
+
r = btrfs_subvol_snapshot(arg_template, arg_directory,
(arg_read_only ? BTRFS_SNAPSHOT_READ_ONLY : 0) |
BTRFS_SNAPSHOT_FALLBACK_COPY |
log_info("Populated %s from template %s.", arg_directory, arg_template);
}
}
+
+ r = chase_symlinks_and_update(&arg_directory);
+ if (r < 0)
+ goto finish;
}
if (arg_start_mode == START_BOOT) {
assert(arg_image);
assert(!arg_template);
+ r = chase_symlinks_and_update(&arg_image);
+ if (r < 0)
+ goto finish;
+
if (arg_ephemeral) {
_cleanup_free_ char *np = NULL;