Date: Wed, 28 Sep 2011 11:40:24 -0400 From: Rich Felker <dalias@...ifal.cx> To: musl@...ts.openwall.com Subject: Re: musl bugs On Wed, Sep 28, 2011 at 11:54:46AM +0400, Vasiliy Kulikov wrote: > On Tue, Sep 27, 2011 at 17:00 -0400, Rich Felker wrote: > > On Tue, Sep 27, 2011 at 08:06:46PM +0400, Vasiliy Kulikov wrote: > > > Hi Rich, > > > > > > getmntent_r(): > > > - fgets() should be checked for too small buffer. > > > > And what should happen? ERANGE? This non-standardized stuff is so > > poorly documented... Should it seek back and allow you to read the > > entry next time with a larger buffer? Or should it just fail? > > The right thing would be seeking back, but at least glibc simply ignores > the error and seeks to the end of line. I don't known whether seek back > is better given this behaviour is not documented... To be consistent > with glibc IMHO it should seek till the EOL, but return the error. If implementations differ, a correct program will always need to save the location and seek back to work reliably. On the other hand, if the implementation seeks back, it will break applications that want to just ignore overly-long lines and keep reading (they'll hit an infinite loop of failures). Also, seeking back the way I do it now causes breakage even if the long line is just a comment. Thus I'm leaning towards going with the glibc behavior. Rich
Powered by blists - more mailing lists
Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.