From: Peter J. Farley III Date: Mon, 16 Oct 2000 18:15:59 +0000 (-0400) Subject: [ID 20001016.012] [PATCHes Included]OK: perl v5.7.0 on dos-djgpp djgpp X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=05af4e39b4c15021ef2967b252f6274e0fb723b9;p=p5sagit%2Fp5-mst-13.2.git [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 --- diff --git a/djgpp/djgpp.c b/djgpp/djgpp.c index c928851..80a627e 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; +} diff --git a/dosish.h b/dosish.h index 08b48fa..5f12b9d 100644 --- a/dosish.h +++ b/dosish.h @@ -100,7 +100,11 @@ #define fwrite1 fwrite #define Fstat(fd,bufptr) fstat((fd),(bufptr)) -#define Fflush(fp) fflush(fp) +#ifdef DJGPP +# define Fflush(fp) djgpp_fflush(fp) +#else +# define Fflush(fp) fflush(fp) +#endif #define Mkdir(path,mode) mkdir((path),(mode)) #ifndef WIN32 diff --git a/t/io/open.t b/t/io/open.t index b224cce..0190281 100755 --- a/t/io/open.t +++ b/t/io/open.t @@ -268,13 +268,13 @@ ok; { local *F; for (1..2) { - open(F, "echo #foo|") or print "not "; + open(F, "echo \\#foo|") or print "not "; print ; close F; } ok; for (1..2) { - open(F, "-|", "echo #foo") or print "not "; + open(F, "-|", "echo \\#foo") or print "not "; print ; close F; }