提交 ede5ae7b 编写于 作者: R Rich Felker

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.
上级 9cee9307
......@@ -25,7 +25,6 @@ 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]");
errno = ERANGE;
return 0;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册