From: Jarkko Hietaniemi Date: Sat, 10 May 2003 06:51:24 +0000 (+0000) Subject: In eof() the errno can get stomped by the peek-ahead. X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=505fdf5d548cad40088ab9dcb60a4212a5c66af0;p=p5sagit%2Fp5-mst-13.2.git In eof() the errno can get stomped by the peek-ahead. p4raw-id: //depot/perl@19470 --- diff --git a/doio.c b/doio.c index 438139f..43c12e7 100644 --- a/doio.c +++ b/doio.c @@ -1030,17 +1030,21 @@ Perl_do_eof(pTHX_ GV *gv) report_evil_fh(gv, io, OP_phoney_OUTPUT_ONLY); while (IoIFP(io)) { + int saverrno; if (PerlIO_has_cntptr(IoIFP(io))) { /* (the code works without this) */ if (PerlIO_get_cnt(IoIFP(io)) > 0) /* cheat a little, since */ return FALSE; /* this is the most usual case */ } + saverrno = errno; /* getc and ungetc can stomp on errno */ ch = PerlIO_getc(IoIFP(io)); if (ch != EOF) { (void)PerlIO_ungetc(IoIFP(io),ch); + errno = saverrno; return FALSE; } + errno = saverrno; if (PerlIO_has_cntptr(IoIFP(io)) && PerlIO_canset_cnt(IoIFP(io))) { if (PerlIO_get_cnt(IoIFP(io)) < -1) diff --git a/ext/Socket/socketpair.t b/ext/Socket/socketpair.t index c600079..9d86be6 100644 --- a/ext/Socket/socketpair.t +++ b/ext/Socket/socketpair.t @@ -124,8 +124,7 @@ SKIP: { ok (eof RIGHT, "right is at EOF"); local $TODO = "Known problems with unix sockets on $^O" if $^O eq 'unicos' || $^O eq 'unicosmk'; - # is ($!, '', 'and $! should report no error'); - ok(1, 'skip this $! test for now'); + is ($!, '', 'and $! should report no error'); alarm 60; }