diff options
author | Jarkko Hietaniemi <jhi@iki.fi> | 2003-07-05 18:40:51 +0000 |
---|---|---|
committer | Jarkko Hietaniemi <jhi@iki.fi> | 2003-07-05 18:40:51 +0000 |
commit | 862083f7e40bc2a9e3b94aedce56c1336e7bdb25 (patch) | |
tree | e6b6972e822ecd085acc58afd935bc721663b6c1 | |
parent | db76e01e0478bf57f584c7a46fe5499fb12f1b27 (diff) | |
download | perl-862083f7e40bc2a9e3b94aedce56c1336e7bdb25.tar.gz |
Make a read from a write-only fh to set errno
(found by Gisle)
p4raw-id: //depot/perl@20019
-rw-r--r-- | perlio.c | 5 |
1 files changed, 4 insertions, 1 deletions
@@ -2033,8 +2033,11 @@ PerlIOBase_read(pTHX_ PerlIO *f, void *vbuf, Size_t count) { STDCHAR *buf = (STDCHAR *) vbuf; if (f) { - if (!(PerlIOBase(f)->flags & PERLIO_F_CANREAD)) + if (!(PerlIOBase(f)->flags & PERLIO_F_CANREAD)) { + PerlIOBase(f)->flags |= PERLIO_F_ERROR; + SETERRNO(EBADF, SS_IVCHAN); return 0; + } while (count > 0) { SSize_t avail = PerlIO_get_cnt(f); SSize_t take = 0; |