summaryrefslogtreecommitdiff
path: root/djgpp
diff options
context:
space:
mode:
authorPeter J. Farley III <pjfarley@banet.net>2000-10-16 14:15:59 -0400
committerJarkko Hietaniemi <jhi@iki.fi>2000-10-16 22:45:16 +0000
commit05af4e39b4c15021ef2967b252f6274e0fb723b9 (patch)
treedde03191911ab8232b20d7f251988faedd92106e /djgpp
parent14638679dafeb8e4998a4e631fea795c5b015a16 (diff)
downloadperl-05af4e39b4c15021ef2967b252f6274e0fb723b9.tar.gz
[ID 20001016.012] [PATCHes Included]OK: perl v5.7.0 on dos-djgpp djgpp
Message-Id: <4.3.1.0.20001016180235.00ac65a0@pop5.banet.net> p4raw-id: //depot/perl@7350
Diffstat (limited to 'djgpp')
-rw-r--r--djgpp/djgpp.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/djgpp/djgpp.c b/djgpp/djgpp.c
index c928851b76..80a627e518 100644
--- a/djgpp/djgpp.c
+++ b/djgpp/djgpp.c
@@ -433,3 +433,22 @@ Perl_DJGPP_init (int *argcp,char ***argvp)
strcpy (perlprefix,"..");
}
+int
+djgpp_fflush (FILE *fp)
+{
+ int res;
+
+ if ((res = fflush(fp)) == 0 && fp) {
+ Stat_t s;
+ if (Fstat(fileno(fp), &s) == 0 && !S_ISSOCK(s.st_mode))
+ res = fsync(fileno(fp));
+ }
+/*
+ * If the flush succeeded but set end-of-file, we need to clear
+ * the error because our caller may check ferror(). BTW, this
+ * probably means we just flushed an empty file.
+ */
+ if (res == 0 && fp && ferror(fp) == EOF) clearerr(fp);
+
+ return res;
+}