summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChip Salzenberg <chip@pobox.com>1999-04-13 04:04:14 +0000
committerTodd Rinaldo <toddr@cpanel.net>2019-10-19 07:03:08 -0500
commitc5d3e7a63e6d26a184e93d01f3d5665a254122fc (patch)
tree8d349354354099847ad175befcfa28444edda6f4
parent78797b2ac4d01047f34d412ff8e28602ae0b3a1b (diff)
downloadperl-c5d3e7a63e6d26a184e93d01f3d5665a254122fc.tar.gz
Preserve errno from importunities of sfio.
p4raw-id: //depot/maint-5.004/perl@3229
-rw-r--r--pp_ctl.c13
-rw-r--r--util.c13
2 files changed, 22 insertions, 4 deletions
diff --git a/pp_ctl.c b/pp_ctl.c
index fd780c248c..84f0101b25 100644
--- a/pp_ctl.c
+++ b/pp_ctl.c
@@ -1109,8 +1109,17 @@ char *message;
}
if(!message)
message = SvPVx(ERRSV, na);
- PerlIO_printf(PerlIO_stderr(), "%s",message);
- PerlIO_flush(PerlIO_stderr());
+ {
+#ifdef USE_SFIO
+ /* SFIO can really mess with your errno */
+ int e = errno;
+#endif
+ PerlIO_puts(PerlIO_stderr(), message);
+ (void)PerlIO_flush(PerlIO_stderr());
+#ifdef USE_SFIO
+ errno = e;
+#endif
+ }
my_failure_exit();
/* NOTREACHED */
return 0;
diff --git a/util.c b/util.c
index 0b6180ff3b..b35d9296f2 100644
--- a/util.c
+++ b/util.c
@@ -1269,8 +1269,17 @@ croak(pat, va_alist)
restartop = die_where(message);
JMPENV_JUMP(3);
}
- PerlIO_puts(PerlIO_stderr(),message);
- (void)PerlIO_flush(PerlIO_stderr());
+ {
+#ifdef USE_SFIO
+ /* SFIO can really mess with your errno */
+ int e = errno;
+#endif
+ PerlIO_puts(PerlIO_stderr(), message);
+ (void)PerlIO_flush(PerlIO_stderr());
+#ifdef USE_SFIO
+ errno = e;
+#endif
+ }
my_failure_exit();
}