diff options
author | Rich Felker <dalias@aerifal.cx> | 2011-09-28 19:37:14 -0400 |
---|---|---|
committer | Rich Felker <dalias@aerifal.cx> | 2011-09-28 19:37:14 -0400 |
commit | ede5ae7b0bb5a7ed9edeb2eeb8e24d30af64d185 (patch) | |
tree | acb18b5c3b9953a8db8124337af1f5531687da9b /src | |
parent | 9cee9307e3b8ed31e772d564d1dc53e6d888acba (diff) | |
download | musl-ede5ae7b0bb5a7ed9edeb2eeb8e24d30af64d185.zip musl-ede5ae7b0bb5a7ed9edeb2eeb8e24d30af64d185.tar.gz musl-ede5ae7b0bb5a7ed9edeb2eeb8e24d30af64d185.tar.bz2 |
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.
Diffstat (limited to 'src')
-rw-r--r-- | src/linux/mntent.c | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/src/linux/mntent.c b/src/linux/mntent.c index f151625..3eafba5 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; } |