diff options
author | dchagin <dchagin@FreeBSD.org> | 2017-07-15 14:48:31 +0000 |
---|---|---|
committer | dchagin <dchagin@FreeBSD.org> | 2017-07-15 14:48:31 +0000 |
commit | c08b329324af7d80610923c5dc830c79f231b778 (patch) | |
tree | 4b6d79b48e0ee31555076f607338a299269e418b /sys/kern | |
parent | 1bff055e045e2a8ad0f75e314656724777279992 (diff) | |
download | FreeBSD-src-c08b329324af7d80610923c5dc830c79f231b778.zip FreeBSD-src-c08b329324af7d80610923c5dc830c79f231b778.tar.gz |
MFC r281829 (by trasz@):
Modify kern___getcwd() to take max pathlen limit as an additional
argument. This will be used for the Linux emulation layer - for Linux,
PATH_MAX is 4096 and not 1024.
Diffstat (limited to 'sys/kern')
-rw-r--r-- | sys/kern/vfs_cache.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/sys/kern/vfs_cache.c b/sys/kern/vfs_cache.c index 346b2af..ec050c0 100644 --- a/sys/kern/vfs_cache.c +++ b/sys/kern/vfs_cache.c @@ -1073,11 +1073,13 @@ int sys___getcwd(struct thread *td, struct __getcwd_args *uap) { - return (kern___getcwd(td, uap->buf, UIO_USERSPACE, uap->buflen)); + return (kern___getcwd(td, uap->buf, UIO_USERSPACE, uap->buflen, + MAXPATHLEN)); } int -kern___getcwd(struct thread *td, char *buf, enum uio_seg bufseg, u_int buflen) +kern___getcwd(struct thread *td, char *buf, enum uio_seg bufseg, u_int buflen, + u_int path_max) { char *bp, *tmpbuf; struct filedesc *fdp; @@ -1088,8 +1090,8 @@ kern___getcwd(struct thread *td, char *buf, enum uio_seg bufseg, u_int buflen) return (ENODEV); if (buflen < 2) return (EINVAL); - if (buflen > MAXPATHLEN) - buflen = MAXPATHLEN; + if (buflen > path_max) + buflen = path_max; tmpbuf = malloc(buflen, M_TEMP, M_WAITOK); fdp = td->td_proc->p_fd; |