linux(4): make linkat(2) handle AT_EMPTY_PATH

Sponsored By:	EPSRC
Differential Revision:	https://reviews.freebsd.org/D29974
This commit is contained in:
Edward Tomasz Napierala 2021-05-04 13:09:31 +01:00
parent 3657010266
commit ee384b229d

View File

@ -1134,11 +1134,12 @@ linux_linkat(struct thread *td, struct linux_linkat_args *args)
char *path, *to;
int error, olddfd, newdfd, flag;
if (args->flag & ~LINUX_AT_SYMLINK_FOLLOW)
if (args->flag & ~(LINUX_AT_SYMLINK_FOLLOW | LINUX_AT_EMPTY_PATH))
return (EINVAL);
flag = (args->flag & LINUX_AT_SYMLINK_FOLLOW) == 0 ? AT_SYMLINK_FOLLOW :
0;
flag |= (args->flag & LINUX_AT_EMPTY_PATH) == 0 ? AT_EMPTY_PATH : 0;
olddfd = (args->olddfd == LINUX_AT_FDCWD) ? AT_FDCWD : args->olddfd;
newdfd = (args->newdfd == LINUX_AT_FDCWD) ? AT_FDCWD : args->newdfd;