summaryrefslogtreecommitdiffstats
path: root/sys/kern/vfs_lookup.c
diff options
context:
space:
mode:
authorkib <kib@FreeBSD.org>2008-04-08 09:45:49 +0000
committerkib <kib@FreeBSD.org>2008-04-08 09:45:49 +0000
commiteb77b477b46f73f94adb6a57311b621ff373ec0d (patch)
tree27aa9d496f901903e5e31001326287aab78c768b /sys/kern/vfs_lookup.c
parentc2a6bed59d13cefde1d4e2483c484d2ff7f534dd (diff)
downloadFreeBSD-src-eb77b477b46f73f94adb6a57311b621ff373ec0d.zip
FreeBSD-src-eb77b477b46f73f94adb6a57311b621ff373ec0d.tar.gz
Implement the linux syscalls
openat, mkdirat, mknodat, fchownat, futimesat, fstatat, unlinkat, renameat, linkat, symlinkat, readlinkat, fchmodat, faccessat. Submitted by: rdivacky Sponsored by: Google Summer of Code 2007 Tested by: pho
Diffstat (limited to 'sys/kern/vfs_lookup.c')
-rw-r--r--sys/kern/vfs_lookup.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/sys/kern/vfs_lookup.c b/sys/kern/vfs_lookup.c
index dc34249..1b295fc 100644
--- a/sys/kern/vfs_lookup.c
+++ b/sys/kern/vfs_lookup.c
@@ -1032,8 +1032,8 @@ NDFREE(struct nameidata *ndp, const u_int flags)
* the M_TEMP bucket if one is returned.
*/
int
-kern_alternate_path(struct thread *td, const char *prefix, char *path,
- enum uio_seg pathseg, char **pathbuf, int create)
+kern_alternate_path(struct thread *td, const char *prefix, const char *path,
+ enum uio_seg pathseg, char **pathbuf, int create, int dirfd)
{
struct nameidata nd, ndroot;
char *ptr, *buf, *cp;
@@ -1071,6 +1071,15 @@ kern_alternate_path(struct thread *td, const char *prefix, char *path,
goto keeporig;
}
+ if (dirfd != AT_FDCWD) {
+ /*
+ * We want the original because the "prefix" is
+ * included in the already opened dirfd.
+ */
+ bcopy(ptr, buf, len);
+ return (0);
+ }
+
/*
* We know that there is a / somewhere in this pathname.
* Search backwards for it, to find the file's parent dir
OpenPOWER on IntegriCloud