From 48b9d4fc6d61dc58aef46b7075962505b43fe905 Mon Sep 17 00:00:00 2001 From: Tony Cook Date: Tue, 27 Apr 2021 16:22:35 +1000 Subject: [PATCH] fix utime() to set $!/errno when called on a closed handle My 8334cae65 was intended to fix this, but the test was faulty, and didn't correctly fail. This started showing as a failure on cygwin, with the fixed test it also fails on Linux, so fix doio.c as well. --- doio.c | 1 + t/io/fs.t | 1 + 2 files changed, 2 insertions(+) diff --git a/doio.c b/doio.c index baca499d102a..76f2e0e84b6a 100644 --- a/doio.c +++ b/doio.c @@ -2766,6 +2766,7 @@ nothing in the core. #endif } else { + SETERRNO(EBADF,RMS_IFI); tot--; } } diff --git a/t/io/fs.t b/t/io/fs.t index a36fbe83ae1f..0628df8afad6 100644 --- a/t/io/fs.t +++ b/t/io/fs.t @@ -265,6 +265,7 @@ SKIP: { check_utime_result($ut, $accurate_timestamps, $delta); # [perl #122703] close $fh; + $! = 0; ok(!utime($ut,$ut + $delta, $fh), "utime fails on a closed file handle"); isnt($!+0, 0, "and errno was set");