From ede5ae7b0bb5a7ed9edeb2eeb8e24d30af64d185 Mon Sep 17 00:00:00 2001 From: Rich Felker Date: Wed, 28 Sep 2011 19:37:14 -0400 Subject: [PATCH 1/1] make getmntent_r discard long lines when it returns error, not seek back seeking back can be performed by the caller, but if the caller doesn't expect it, it will result in an infinite loop of failures. --- src/linux/mntent.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/linux/mntent.c b/src/linux/mntent.c index f1516252..3eafba5e 100644 --- a/src/linux/mntent.c +++ b/src/linux/mntent.c @@ -25,8 +25,7 @@ struct mntent *getmntent_r(FILE *f, struct mntent *mnt, char *linebuf, int bufle fgets(linebuf, buflen, f); if (feof(f) || ferror(f)) return 0; if (!strchr(linebuf, '\n')) { - if (fseeko(f, -(off_t)strlen(linebuf), SEEK_CUR)) - fscanf(f, "%*[^\n]%*[\n]"); + fscanf(f, "%*[^\n]%*[\n]"); errno = ERANGE; return 0; } -- 2.20.1