This is the mail archive of the
libstdc++@gcc.gnu.org
mailing list for the libstdc++ project.
[RFC] Shall we loop on EINTR for fclose too?
- From: Paolo Carlini <pcarlini at suse dot de>
- To: libstdc++ <libstdc++ at gcc dot gnu dot org>
- Cc: Nathan Myers <ncm at cantrip dot org>, ken at xorian dot net
- Date: Sat, 28 Aug 2004 02:07:15 +0200
- Subject: [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.