[Gc] GC patch for DJGPP
Sun, 2 Nov 2003 11:32:09 -0800 (PST)
On Mon, 3 Nov 2003, Fergus Henderson wrote:
> On 01-Nov-2003, Doug Kaufman <email@example.com> wrote:
> > The errno was EACCESS. Adding a call to fflush() seems to fix the
> > problem. I am not really sure why.
> > if ((f = fopen(FNAME2, "w")) == 0) ABORT("2nd open failed");
> > + fflush(f);
> That really ought to be
> if (fflush(f) == EOF) ABORT("fflush failed");
But how do you make this compatible across different operating
systems? The DJGPP version of fflush returns "0" on success and "-1"
on failure. I see that Redhat linux, cygwin, and SunOS 4.1 all return
EOF on failure and "0" on success. So you would probably be better off
using "if (fflush(f) != 0)".