summaryrefslogtreecommitdiff
path: root/perl.c
diff options
context:
space:
mode:
authorH.Merijn Brand <h.m.brand@xs4all.nl>2016-08-19 20:44:14 +0200
committerH.Merijn Brand <h.m.brand@xs4all.nl>2016-08-19 20:44:14 +0200
commit675c73ca278d0bfeffeeb2a3f4cdea82e8b8b8c4 (patch)
tree61560f1cba841c52a449db170969bf71ee9d7c89 /perl.c
parent9fb994be1361ac6bc42256ee6a710159cf050ca5 (diff)
downloadperl-675c73ca278d0bfeffeeb2a3f4cdea82e8b8b8c4.tar.gz
Do not show error message if errno = 0 for flush fail on STDOUT
Somehow (on HP-UX Itanium) the flush fails, but errno is still 0 The lib/warnings.t test then shows EXPECTED: Filehandle STDOUT opened only for output at - line 3. GOT: Filehandle STDOUT opened only for output at - line 3. Unable to flush stdout: Error 0 This change suppresses that last line if errno is (still) 0
Diffstat (limited to 'perl.c')
-rw-r--r--perl.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/perl.c b/perl.c
index 6618535741..1ceed1cd85 100644
--- a/perl.c
+++ b/perl.c
@@ -621,8 +621,9 @@ perl_destruct(pTHXx)
PerlIO *stdo = PerlIO_stdout();
if (*stdo && PerlIO_flush(stdo)) {
PerlIO_restore_errno(stdo);
- PerlIO_printf(PerlIO_stderr(), "Unable to flush stdout: %s",
- Strerror(errno));
+ if (errno)
+ PerlIO_printf(PerlIO_stderr(), "Unable to flush stdout: %s",
+ Strerror(errno));
if (!STATUS_UNIX)
STATUS_ALL_FAILURE;
}