I just checked FreeBSD libc, and it appears that fflush fails once its underlying write fails with EAGAIN. So it appears that this approach won't work under FreeBSD. That's not a good sign.
Isn't that a bug in FreeBSD? We can try to work around bugs in various systems, but it is not an essential requirement that we do so. If it is hard to work around them, the best we can do is report them and hope they get fixed by and by. Can you write a program to detect whether fflush reliably restarts? I just wrote the program below to do that, derived from your code, and it fails for me both with Debian GNU/Linux 3.1 r0a and with Solaris 10, so that's not a good sign either. I am not sure what job that program does. The program is too long for me to read it just to try to figure that out. However, if it is impossible to do this job reliably for fflush, we can still adapt the solution to that fact, by using #define fflush undefined_fflush so that people can modify the relevant apps not to use fflush. _______________________________________________ Bug-cvs mailing list Bug-cvs@gnu.org http://lists.gnu.org/mailman/listinfo/bug-cvs