< prev index next >
src/solaris/classes/sun/nio/fs/LinuxFileSystem.java
Print this page
*** 1,7 ****
/*
! * Copyright (c) 2008, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
--- 1,7 ----
/*
! * Copyright (c) 2008, 2019, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
*** 77,90 ****
*/
List<UnixMountEntry> getMountEntries(String fstab) {
ArrayList<UnixMountEntry> entries = new ArrayList<>();
try {
long fp = setmntent(Util.toBytes(fstab), Util.toBytes("r"));
try {
for (;;) {
UnixMountEntry entry = new UnixMountEntry();
! int res = getmntent(fp, entry);
if (res < 0)
break;
entries.add(entry);
}
} finally {
--- 77,106 ----
*/
List<UnixMountEntry> getMountEntries(String fstab) {
ArrayList<UnixMountEntry> entries = new ArrayList<>();
try {
long fp = setmntent(Util.toBytes(fstab), Util.toBytes("r"));
+ int maxLineSize = 1024;
+ try {
+ for (;;) {
+ int lineSize = getlinelen(fp);
+ if (lineSize == -1)
+ break;
+ if (lineSize > maxLineSize)
+ maxLineSize = lineSize;
+ }
+ } catch (UnixException x) {
+ // nothing we need to do
+ } finally {
+ rewind(fp);
+ }
+
try {
for (;;) {
UnixMountEntry entry = new UnixMountEntry();
! // count in NUL character at the end
! int res = getmntent(fp, entry, maxLineSize + 1);
if (res < 0)
break;
entries.add(entry);
}
} finally {
< prev index next >