8229872: (fs) Increase buffer size used with getmntent

Dynamically allocate memory for getmntent

Reviewed-by: alanb
This commit is contained in:
Vladimir Kempik 2019-09-24 14:54:57 +03:00
parent 628283fe53
commit 67ad501e5b
5 changed files with 89 additions and 9 deletions

View file

@ -51,7 +51,17 @@ class LinuxNativeDispatcher extends UnixNativeDispatcher {
/**
* int getmntent(FILE *fp, struct mnttab *mp, int len);
*/
static native int getmntent(long fp, UnixMountEntry entry)
static int getmntent(long fp, UnixMountEntry entry, int buflen) throws UnixException {
NativeBuffer buffer = NativeBuffers.getNativeBuffer(buflen);
try {
return getmntent0(fp, entry, buffer.address(), buflen);
} finally {
buffer.release();
}
}
static native int getmntent0(long fp, UnixMountEntry entry, long buffer, int bufLen)
throws UnixException;
/**