return -errno;
}
- r = tempfn_random_child(to, "hardlink", &c->subdir);
+ if (to)
+ r = tempfn_random_child(to, "hardlink", &c->subdir);
+ else
+ r = tempfn_random("hardlink", /* extra= */ NULL, &c->subdir);
if (r < 0)
return r;
int r;
assert(st);
- assert(to);
if (depth_left == 0)
return -ENAMETOOLONG;
override_gid, copy_flags, denylist, subvolumes, hardlink_context,
display_path, progress_path, progress_bytes, userdata);
+ /* Only if we are copying a directory we are fine if the target dir is referenced by fd only */
+ if (!to)
+ return -ENOTDIR;
+
DenyType t = PTR_TO_INT(hashmap_get(denylist, st));
if (t == DENY_INODE) {
log_debug("%s is in the denylist, ignoring", from ?: "file to copy");
struct stat st;
int r;
- assert(to);
assert(!FLAGS_SET(copy_flags, COPY_LOCK_BSD));
if (fstatat(fdf, strempty(from), &st, AT_SYMLINK_NOFOLLOW | (isempty(from) ? AT_EMPTY_PATH : 0)) < 0)