File tree Expand file tree Collapse file tree 2 files changed +16
-6
lines changed Expand file tree Collapse file tree 2 files changed +16
-6
lines changed Original file line number Diff line number Diff line change @@ -410,13 +410,21 @@ ferror(handle)
410
410
411
411
int
412
412
clearerr (handle )
413
- InputStream handle
413
+ SV * handle
414
+ PREINIT :
415
+ IO * io = sv_2io (handle );
416
+ InputStream in = IoIFP (io );
417
+ OutputStream out = IoOFP (io );
414
418
CODE :
415
419
if (handle ) {
416
420
#ifdef PerlIO
417
- PerlIO_clearerr (handle );
421
+ PerlIO_clearerr (in );
422
+ if (in != out )
423
+ PerlIO_clearerr (out );
418
424
#else
419
- clearerr (handle );
425
+ clearerr (in );
426
+ if (in != out )
427
+ clearerr (out );
420
428
#endif
421
429
RETVAL = 0 ;
422
430
}
Original file line number Diff line number Diff line change @@ -11,7 +11,7 @@ BEGIN {
11
11
}
12
12
}
13
13
14
- use Test::More tests => 7 ;
14
+ use Test::More tests => 8 ;
15
15
use IO::File;
16
16
use IO::Seekable;
17
17
@@ -58,12 +58,14 @@ SKIP: {
58
58
# This isn't really a Linux/BSD specific test, but /dev/full is (I
59
59
# hope) reasonably well defined on these. Patches welcome if your platform
60
60
# also supports it (or something like it)
61
- skip " no /dev/full or not a /dev/full platform" , 2
61
+ skip " no /dev/full or not a /dev/full platform" , 3
62
62
unless $^O =~ / ^(linux|netbsd|freebsd)$ / && -c " /dev/full" ;
63
63
open my $fh , " >" , " /dev/full"
64
- or skip " Could not open /dev/full: $! " , 2 ;
64
+ or skip " Could not open /dev/full: $! " , 3 ;
65
65
$fh -> print (" a" x 1024 );
66
66
ok(!$fh -> flush, " should fail to flush" );
67
67
ok($fh -> error, " stream should be in error" );
68
+ $fh -> clearerr;
69
+ ok(!$fh -> error, " check clearerr removed the error" );
68
70
close $fh ; # silently ignore the error
69
71
}
You can’t perform that action at this time.
0 commit comments