summaryrefslogtreecommitdiffstats
path: root/sys/compat
diff options
context:
space:
mode:
authorrdivacky <rdivacky@FreeBSD.org>2008-04-09 16:42:50 +0000
committerrdivacky <rdivacky@FreeBSD.org>2008-04-09 16:42:50 +0000
commit69ec9a439cda4fb79f94985315b7a90845c0c8c4 (patch)
tree553c83392169c6b4a3b85f225a2b50f14807b9d2 /sys/compat
parent59c9f770cb8293ea8f2c4072435f8a90b2070bdb (diff)
downloadFreeBSD-src-69ec9a439cda4fb79f94985315b7a90845c0c8c4.zip
FreeBSD-src-69ec9a439cda4fb79f94985315b7a90845c0c8c4.tar.gz
Remove using magic value of -1 to distinguish between linux_open()
and linux_openat(). Instead just pass AT_FDCWD into linux_common_open() for the linux_open() case. This prevents passing -1 as a dirfd to openat() from succeeding which is wrong. Suggested by: rwatson, kib Approved by: kib (mentor)
Diffstat (limited to 'sys/compat')
-rw-r--r--sys/compat/linux/linux_file.c8
1 files changed, 3 insertions, 5 deletions
diff --git a/sys/compat/linux/linux_file.c b/sys/compat/linux/linux_file.c
index 646f6eb..49e9cd2 100644
--- a/sys/compat/linux/linux_file.c
+++ b/sys/compat/linux/linux_file.c
@@ -131,10 +131,8 @@ linux_common_open(struct thread *td, int dirfd, char *path, int l_flags, int mod
bsd_flags |= O_NOFOLLOW;
/* XXX LINUX_O_NOATIME: unable to be easily implemented. */
- if (dirfd != -1)
- error = kern_openat(td, dirfd, path, UIO_SYSSPACE, bsd_flags, mode);
- else
- error = kern_open(td, path, UIO_SYSSPACE, bsd_flags, mode);
+ error = kern_openat(td, dirfd, path, UIO_SYSSPACE, bsd_flags, mode);
+
if (!error) {
fd = td->td_retval[0];
/*
@@ -215,7 +213,7 @@ linux_open(struct thread *td, struct linux_open_args *args)
path, args->flags, args->mode);
#endif
- return (linux_common_open(td, -1, path, args->flags, args->mode));
+ return (linux_common_open(td, AT_FDCWD, path, args->flags, args->mode));
}
int
OpenPOWER on IntegriCloud