Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F107351829
D29776.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
4 KB
Referenced Files
None
Subscribers
None
D29776.diff
View Options
diff --git a/sys/compat/cloudabi/cloudabi_file.c b/sys/compat/cloudabi/cloudabi_file.c
--- a/sys/compat/cloudabi/cloudabi_file.c
+++ b/sys/compat/cloudabi/cloudabi_file.c
@@ -185,7 +185,7 @@
error = kern_linkat(td, uap->fd1.fd, uap->fd2, path1, path2,
UIO_SYSSPACE, (uap->fd1.flags & CLOUDABI_LOOKUP_SYMLINK_FOLLOW) ?
- FOLLOW : NOFOLLOW);
+ AT_SYMLINK_FOLLOW : 0);
cloudabi_freestr(path1);
cloudabi_freestr(path2);
return (error);
diff --git a/sys/compat/linux/linux_file.c b/sys/compat/linux/linux_file.c
--- a/sys/compat/linux/linux_file.c
+++ b/sys/compat/linux/linux_file.c
@@ -1111,7 +1111,7 @@
if (!LUSECONVPATH(td)) {
return (kern_linkat(td, AT_FDCWD, AT_FDCWD, args->path, args->to,
- UIO_USERSPACE, FOLLOW));
+ UIO_USERSPACE, AT_SYMLINK_FOLLOW));
}
LCONVPATHEXIST(td, args->path, &path);
/* Expand LCONVPATHCREATE so that `path' can be freed on errors */
@@ -1121,7 +1121,7 @@
return (error);
}
error = kern_linkat(td, AT_FDCWD, AT_FDCWD, path, to, UIO_SYSSPACE,
- FOLLOW);
+ AT_SYMLINK_FOLLOW);
LFREEPATH(path);
LFREEPATH(to);
return (error);
@@ -1132,18 +1132,19 @@
linux_linkat(struct thread *td, struct linux_linkat_args *args)
{
char *path, *to;
- int error, olddfd, newdfd, follow;
+ int error, olddfd, newdfd, flag;
if (args->flag & ~LINUX_AT_SYMLINK_FOLLOW)
return (EINVAL);
+ flag = (args->flag & LINUX_AT_SYMLINK_FOLLOW) == 0 ? AT_SYMLINK_FOLLOW :
+ 0;
+
olddfd = (args->olddfd == LINUX_AT_FDCWD) ? AT_FDCWD : args->olddfd;
newdfd = (args->newdfd == LINUX_AT_FDCWD) ? AT_FDCWD : args->newdfd;
- follow = (args->flag & LINUX_AT_SYMLINK_FOLLOW) == 0 ? NOFOLLOW :
- FOLLOW;
if (!LUSECONVPATH(td)) {
return (kern_linkat(td, olddfd, newdfd, args->oldname,
- args->newname, UIO_USERSPACE, follow));
+ args->newname, UIO_USERSPACE, flag));
}
LCONVPATHEXIST_AT(td, args->oldname, &path, olddfd);
/* Expand LCONVPATHCREATE so that `path' can be freed on errors */
@@ -1152,7 +1153,7 @@
LFREEPATH(path);
return (error);
}
- error = kern_linkat(td, olddfd, newdfd, path, to, UIO_SYSSPACE, follow);
+ error = kern_linkat(td, olddfd, newdfd, path, to, UIO_SYSSPACE, flag);
LFREEPATH(path);
LFREEPATH(to);
return (error);
diff --git a/sys/kern/vfs_syscalls.c b/sys/kern/vfs_syscalls.c
--- a/sys/kern/vfs_syscalls.c
+++ b/sys/kern/vfs_syscalls.c
@@ -1495,7 +1495,7 @@
{
return (kern_linkat(td, AT_FDCWD, AT_FDCWD, uap->path, uap->link,
- UIO_USERSPACE, FOLLOW));
+ UIO_USERSPACE, AT_SYMLINK_FOLLOW));
}
#ifndef _SYS_SYSPROTO_H_
@@ -1518,8 +1518,7 @@
return (EINVAL);
return (kern_linkat(td, uap->fd1, uap->fd2, uap->path1, uap->path2,
- UIO_USERSPACE, at2cnpflags(flag, AT_SYMLINK_FOLLOW |
- AT_RESOLVE_BENEATH | AT_EMPTY_PATH)));
+ UIO_USERSPACE, flag));
}
int hardlink_check_uid = 0;
@@ -1563,15 +1562,16 @@
int
kern_linkat(struct thread *td, int fd1, int fd2, const char *path1,
- const char *path2, enum uio_seg segflag, int follow)
+ const char *path2, enum uio_seg segflag, int flag)
{
struct nameidata nd;
int error;
do {
bwillwrite();
- NDINIT_ATRIGHTS(&nd, LOOKUP, follow | AUDITVNODE1, segflag,
- path1, fd1, &cap_linkat_source_rights, td);
+ NDINIT_ATRIGHTS(&nd, LOOKUP, AUDITVNODE1 | at2cnpflags(flag,
+ AT_SYMLINK_FOLLOW | AT_RESOLVE_BENEATH | AT_EMPTY_PATH),
+ segflag, path1, fd1, &cap_linkat_source_rights, td);
if ((error = namei(&nd)) != 0)
return (error);
NDFREE(&nd, NDF_ONLY_PNBUF);
diff --git a/sys/sys/syscallsubr.h b/sys/sys/syscallsubr.h
--- a/sys/sys/syscallsubr.h
+++ b/sys/sys/syscallsubr.h
@@ -184,7 +184,7 @@
int kern_kldstat(struct thread *td, int fileid, struct kld_file_stat *stat);
int kern_kldunload(struct thread *td, int fileid, int flags);
int kern_linkat(struct thread *td, int fd1, int fd2, const char *path1,
- const char *path2, enum uio_seg segflg, int follow);
+ const char *path2, enum uio_seg segflg, int flag);
int kern_listen(struct thread *td, int s, int backlog);
int kern_lseek(struct thread *td, int fd, off_t offset, int whence);
int kern_lutimes(struct thread *td, const char *path, enum uio_seg pathseg,
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Mon, Jan 13, 9:59 PM (20 h, 9 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
15787796
Default Alt Text
D29776.diff (4 KB)
Attached To
Mode
D29776: kern_linkat: modify to accept AT_ flags instead of FOLLOW/NOFOLLOW
Attached
Detach File
Event Timeline
Log In to Comment