diff options
Diffstat (limited to 'sys/kern/vfs_lookup.c')
-rw-r--r-- | sys/kern/vfs_lookup.c | 13 |
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 |