diff options
author | Evan Miller <eam@frap.net> | 2012-05-31 23:52:26 +1000 |
---|---|---|
committer | Tony Cook <tony@develop-help.com> | 2012-06-01 21:21:32 +1000 |
commit | 2ba489e651f762c7947725b01a3955891d4db36d (patch) | |
tree | 56718ec5576176460794e935f1443a476c1d026b /dist/IO | |
parent | e388dffffac865357da47679aeff0b90d69abe02 (diff) | |
download | perl-2ba489e651f762c7947725b01a3955891d4db36d.tar.gz |
[perl #64772] check both input and output file handles for sync
This allows sync() to be called on directory handles.
Originally supplied as a diff, applied and updated to pass tests by
Tony Cook.
Diffstat (limited to 'dist/IO')
-rw-r--r-- | dist/IO/IO.pm | 2 | ||||
-rw-r--r-- | dist/IO/IO.xs | 9 | ||||
-rw-r--r-- | dist/IO/t/io_xs.t | 1 |
3 files changed, 8 insertions, 4 deletions
diff --git a/dist/IO/IO.pm b/dist/IO/IO.pm index e6f5567b9f..011603fe90 100644 --- a/dist/IO/IO.pm +++ b/dist/IO/IO.pm @@ -7,7 +7,7 @@ use Carp; use strict; use warnings; -our $VERSION = "1.25_06"; +our $VERSION = "1.25_07"; XSLoader::load 'IO', $VERSION; sub import { diff --git a/dist/IO/IO.xs b/dist/IO/IO.xs index 0501567157..085db547f7 100644 --- a/dist/IO/IO.xs +++ b/dist/IO/IO.xs @@ -466,10 +466,15 @@ setvbuf(...) SysRet -fsync(handle) - OutputStream handle +fsync(arg) + SV * arg + PREINIT: + OutputStream handle = NULL; CODE: #ifdef HAS_FSYNC + handle = IoOFP(sv_2io(arg)); + if (!handle) + handle = IoIFP(sv_2io(arg)); if(handle) RETVAL = fsync(PerlIO_fileno(handle)); else { diff --git a/dist/IO/t/io_xs.t b/dist/IO/t/io_xs.t index a86ee7e0f1..968b3f516d 100644 --- a/dist/IO/t/io_xs.t +++ b/dist/IO/t/io_xs.t @@ -45,6 +45,5 @@ SKIP: and skip "directory sync doesn't apply to MSWin32", 1; open my $dh, "<", "." or skip "Cannot open the cwd", 1; - local $TODO = "[perl #64772] IO::Handle->sync fails on an O_RDONLY descriptor"; ok($dh->sync, "sync to a read only directory handle"); } |