summaryrefslogtreecommitdiffstats
path: root/sys/compat/linux
diff options
context:
space:
mode:
authortrasz <trasz@FreeBSD.org>2015-04-21 13:55:24 +0000
committertrasz <trasz@FreeBSD.org>2015-04-21 13:55:24 +0000
commit598f70c8b4adff38f53a5a95888cc863bd35bab4 (patch)
treeb66198948483bc993331cfa74ee83476af8aa51b /sys/compat/linux
parent25e5e803e77bc9385fbd54fcaf14eae06251d6f8 (diff)
downloadFreeBSD-src-598f70c8b4adff38f53a5a95888cc863bd35bab4.zip
FreeBSD-src-598f70c8b4adff38f53a5a95888cc863bd35bab4.tar.gz
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. Differential Revision: https://reviews.freebsd.org/D2335 Reviewed by: kib@ MFC after: 1 month Sponsored by: The FreeBSD Foundation
Diffstat (limited to 'sys/compat/linux')
-rw-r--r--sys/compat/linux/linux_getcwd.c7
-rw-r--r--sys/compat/linux/linux_misc.h2
2 files changed, 6 insertions, 3 deletions
diff --git a/sys/compat/linux/linux_getcwd.c b/sys/compat/linux/linux_getcwd.c
index 1c7080d..7c0b9ba 100644
--- a/sys/compat/linux/linux_getcwd.c
+++ b/sys/compat/linux/linux_getcwd.c
@@ -57,6 +57,7 @@ __FBSDID("$FreeBSD$");
#include <machine/../linux/linux.h>
#include <machine/../linux/linux_proto.h>
#endif
+#include <compat/linux/linux_misc.h>
#include <compat/linux/linux_util.h>
#include <security/mac/mac_framework.h>
@@ -423,14 +424,14 @@ linux_getcwd(struct thread *td, struct linux_getcwd_args *args)
len = args->bufsize;
- if (len > MAXPATHLEN*4)
- len = MAXPATHLEN*4;
+ if (len > LINUX_PATH_MAX)
+ len = LINUX_PATH_MAX;
else if (len < 2)
return ERANGE;
path = malloc(len, M_TEMP, M_WAITOK);
- error = kern___getcwd(td, path, UIO_SYSSPACE, len);
+ error = kern___getcwd(td, path, UIO_SYSSPACE, len, LINUX_PATH_MAX);
if (!error) {
lenused = strlen(path) + 1;
if (lenused <= args->bufsize) {
diff --git a/sys/compat/linux/linux_misc.h b/sys/compat/linux/linux_misc.h
index 154d78f..51135d8 100644
--- a/sys/compat/linux/linux_misc.h
+++ b/sys/compat/linux/linux_misc.h
@@ -55,6 +55,8 @@
#define LINUX_MREMAP_MAYMOVE 1
#define LINUX_MREMAP_FIXED 2
+#define LINUX_PATH_MAX 4096
+
extern const char *linux_platform;
/*
OpenPOWER on IntegriCloud