From: Robin Barker <RMBarker@cpan.org>
Date: Tue, 9 Jul 2002 20:03:40 +0000 (+0100)
Subject: 5.8.0-RC1 on SunOS 4!
X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=f13a2bc0291ac6766d77bda1b46c5921237360c9;p=p5sagit%2Fp5-mst-13.2.git

5.8.0-RC1 on SunOS 4!
Message-Id: <200207091903.UAA09531@tempest.npl.co.uk>

(the sprintf() spot in Dumper.xs fixed)

p4raw-id: //depot/perl@17450
---

diff --git a/ext/Data/Dumper/Dumper.xs b/ext/Data/Dumper/Dumper.xs
index a129c3f..63b0f79 100644
--- a/ext/Data/Dumper/Dumper.xs
+++ b/ext/Data/Dumper/Dumper.xs
@@ -152,7 +152,16 @@ esc_q_utf8(pTHX_ SV* sv, register char *src, register STRLEN slen)
             else if (k < 0x80)
                 *r++ = (char)k;
             else {
-                r += sprintf(r, "\\x{%"UVxf"}", k);
+	      /* The return value of sprintf() is unportable.
+	       * In modern systems it returns (int) the number of characters,
+	       * but in older systems it might return (char*) the original
+	       * buffer, or it might even be (void).  The easiest portable
+	       * thing to do is probably use sprintf() in void context and
+	       * then strlen(buffer) for the length.  The more proper way
+	       * would of course be to figure out the prototype of sprintf.
+	       * --jhi */
+	        sprintf(r, "\\x{%"UVxf"}", k);
+                r += strlen(r);
             }
         }
         *r++ = '"';
diff --git a/perl.c b/perl.c
index 3c2a04f..f7131d0 100644
--- a/perl.c
+++ b/perl.c
@@ -431,7 +431,7 @@ perl_destruct(pTHXx)
     FREETMPS;
 
     /* Need to flush since END blocks can produce output */
-    PerlIO_flush((PerlIO*)NULL);
+    my_fflush_all();
 
     if (CALL_FPTR(PL_threadhook)(aTHX)) {
         /* Threads hook has vetoed further cleanup */
diff --git a/util.c b/util.c
index 2668755..623c44c 100644
--- a/util.c
+++ b/util.c
@@ -3391,6 +3391,7 @@ Perl_my_fflush_all(pTHX)
     return PerlIO_flush(NULL);
 #else
 # if defined(HAS__FWALK)
+    extern int fflush(FILE *);
     /* undocumented, unprototyped, but very useful BSDism */
     extern void _fwalk(int (*)(FILE *));
     _fwalk(&fflush);