summaryrefslogtreecommitdiff
path: root/libc/misc/mntent
diff options
context:
space:
mode:
Diffstat (limited to 'libc/misc/mntent')
-rw-r--r--libc/misc/mntent/mntent.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/libc/misc/mntent/mntent.c b/libc/misc/mntent/mntent.c
index 93d591812..d98a6870f 100644
--- a/libc/misc/mntent/mntent.c
+++ b/libc/misc/mntent/mntent.c
@@ -65,10 +65,17 @@ struct mntent *getmntent_r (FILE *filep,
struct mntent *getmntent(FILE * filep)
{
struct mntent *tmp;
- static char buff[BUFSIZ];
+ static char *buff = NULL;
static struct mntent mnt;
LOCK;
- tmp = getmntent_r(filep, &mnt, buff, sizeof buff);
+
+ if (!buff) {
+ buff = malloc(BUFSIZ);
+ if (!buff)
+ abort();
+ }
+
+ tmp = getmntent_r(filep, &mnt, buff, BUFSIZ);
UNLOCK;
return(tmp);
}