This is the mail archive of the libstdc++@gcc.gnu.org mailing list for the libstdc++ project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[RFC] Shall we loop on EINTR for fclose too?


Hi,

PR libstdc++/17215 seems rather simple: in filebuf we are missing a check on
the return value of fclose and filebuf::close() doesn't return a null pointer
when the underlying fclose fails: we add the check and we are mostly done...


However, there is a special case: what if fclose sets errno = EINTR? The C
standard doesn't mention this possibility (Posix does) and the C++ standard
only says: call fclose.

It seems to me that the best solution is at the abstraction level of our
__basic_file<>::close: we should *loop* on EINTR there, exactly as we are
already doing for read and write.

We return error (a null pointer) to the caller (filebuf::close()) only in
case of real error. Before returning, in any case (real error or success) we
shall zero _M_cfile (the FILE*).

Thanks for any feedback!
Paolo.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]