could be defined by a translator installed into C<$^H{charnames}>.
See L<charnames/CUSTOM ALIASES>.
+=item chdir() on unopened filehandle %s
+
+(W unopened) You tried chdir() on a filehandle that was never opened.
+
=item \C no longer supported in regex; marked by S<<-- HERE> in m/%s/
(F) The \C character class used to allow a match of single byte within a
SV * const sv = POPs;
if (PL_op->op_flags & OPf_SPECIAL) {
gv = gv_fetchsv(sv, 0, SVt_PVIO);
+ if (!gv) {
+ if (ckWARN(WARN_UNOPENED)) {
+ Perl_warner(aTHX_ packWARN(WARN_UNOPENED),
+ "chdir() on unopened filehandle %" SVf, sv);
+ }
+ SETERRNO(EBADF,RMS_IFI);
+ PUSHi(0);
+ TAINT_PROPER("chdir");
+ RETURN;
+ }
}
else if (!(gv = MAYBE_DEREF_GV(sv)))
tmps = SvPV_nomg_const_nolen(sv);
# possibilities into @INC.
unshift @INC, qw(t . lib ../lib);
require "./test.pl";
- plan(tests => 39);
+ plan(tests => 44);
}
use Config;
-use Errno qw(ENOENT);
+use Errno qw(ENOENT EBADF);
my $IsVMS = $^O eq 'VMS';
$Cwd = abs_path;
SKIP: {
- skip("no fchdir", 16) unless $has_fchdir;
+ skip("no fchdir", 21) unless $has_fchdir;
my $has_dirfd = ($Config{d_dirfd} || $Config{d_dir_dd_fd} || "") eq "define";
ok(opendir(my $dh, "."), "opendir .");
ok(open(my $fh, "<", "op"), "open op");
ok(closedir(H), "closedir");
ok(chdir(H), "fchdir to base");
ok(-f "cond.t", "verify that we are in 'base'");
+ ok(close(H), "close");
+ $! = 0;
+ ok(!chdir(H), "check we can't chdir to closed handle");
+ is(0+$!, EBADF, 'check $! set appropriately');
+ $! = 0;
+ ok(!chdir(NEVEROPENED), "check we can't chdir to never opened handle");
+ is(0+$!, EBADF, 'check $! set appropriately');
chdir ".." or die $!;
}