@@ -35,13 +35,18 @@
}
#endif
oldpath = oldname;
- if (pseudo_chroot_len && !strncmp(oldpath, pseudo_chroot, pseudo_chroot_len) &&
+ if (oldpath && !*oldpath && pseudo_chroot_len && !strncmp(oldpath, pseudo_chroot, pseudo_chroot_len) &&
oldpath[pseudo_chroot_len] == '/') {
oldpath += pseudo_chroot_len;
}
newpath = pseudo_root_path(__func__, __LINE__, newdirfd, newname, AT_SYMLINK_NOFOLLOW);
+ if ((!oldpath || !*oldpath) && (flags & AT_EMPTY_PATH)) {
+ tmpfile_fd = olddirfd;
+ // call actual link
+ rc = real_linkat(olddirfd, "", AT_FDCWD, newpath, flags);
+ } else
/* weird special case: if you link /proc/self/fd/N, you're supposed
* to get a link to fd N. Used in conjunction with opening a directory
* with O_TMPFILE in flags, which actually opens an already-deleted
Currently we don't cover the case where AT_EMPTY_PATH is set for atlink. Update the code to handle this case in a similar way to the /proc/self case which is similar. This is used by some systemd tools which OE might run at rootfs time such as hwdb generation. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org> --- ports/unix/guts/linkat.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)