This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Integrate:
authorSlaven Rezic <slaven@rezic.de>
Sun, 19 Oct 2003 17:54:59 +0000 (19:54 +0200)
committerNicholas Clark <nick@ccl4.org>
Mon, 20 Oct 2003 20:14:57 +0000 (20:14 +0000)
[ 21505]
Subject: Re: [perl #24225] [5.8.1] segfault in binmode STDOUT, ':stdio'; print 1
Message-ID: <871xt9te7g.fsf@vran.herceg.de>
p4raw-link: @21505 on //depot/perl: a0625d383a69c2c6fd20da94ef6df644cb75b45b

p4raw-id: //depot/maint-5.8/perl@21507
p4raw-integrated: from //depot/perl@21504 'copy in' perlio.c (@21360..)

perlio.c

index faa3b19..c4a81af 100644 (file)
--- a/perlio.c
+++ b/perlio.c
@@ -2613,8 +2613,10 @@ char *
 PerlIOStdio_mode(const char *mode, char *tmode)
 {
     char *ret = tmode;
-    while (*mode) {
-       *tmode++ = *mode++;
+    if (mode) {
+       while (*mode) {
+           *tmode++ = *mode++;
+       }
     }
 #if defined(PERLIO_USING_CRLF) || defined(__CYGWIN__)
     *tmode++ = 'b';