diff --git a/src/repart/repart.c b/src/repart/repart.c index 133a8e0211..8cfb798339 100644 --- a/src/repart/repart.c +++ b/src/repart/repart.c @@ -10964,7 +10964,7 @@ static int find_root(Context *context) { } else if (r < 0) return log_error_errno(r, "Failed to read symlink /run/systemd/volatile-root: %m"); else { - r = acquire_root_devno(device, NULL, open_flags, &context->node, &context->backing_fd); + r = acquire_root_devno(device, /* root= */ NULL, open_flags, &context->node, &context->backing_fd); if (r == -EUCLEAN) return btrfs_log_dev_root(LOG_ERR, r, device); if (r < 0) @@ -11389,7 +11389,9 @@ static int vl_method_run( return r; if (p.node) { - context->node = TAKE_PTR(p.node); + r = acquire_root_devno(p.node, NULL, O_CLOEXEC|context_open_mode(context), &context->node, &context->backing_fd); + if (r < 0) + return log_error_errno(r, "Failed to open file or determine backing device of %s: %m", p.node); r = context_load_partition_table(context); if (r == -EHWPOISON)