diff options
author | Steve Peters <steve@fisharerojo.org> | 2006-01-04 03:31:08 +0000 |
---|---|---|
committer | Steve Peters <steve@fisharerojo.org> | 2006-01-04 03:31:08 +0000 |
commit | abc7ecadcc190c88a6e937c16c4214f4d0fac0b3 (patch) | |
tree | 6fec329aef9b5cf5514aeff5e2a79a5d43ca717b /pp_sys.c | |
parent | 4ae8a42e2d893d542fe5ac274d3d7a2fb77e0f25 (diff) | |
download | perl-abc7ecadcc190c88a6e937c16c4214f4d0fac0b3.tar.gz |
Add warnings for the various other *dir() functions when attempted
on invalid dirhandles.
p4raw-id: //depot/perl@26631
Diffstat (limited to 'pp_sys.c')
-rw-r--r-- | pp_sys.c | 37 |
1 files changed, 27 insertions, 10 deletions
@@ -3743,8 +3743,13 @@ PP(pp_telldir) GV * const gv = (GV*)POPs; register IO * const io = GvIOn(gv); - if (!io || !IoDIRP(io)) - goto nope; + if (!io || !IoDIRP(io)) { + if(ckWARN(WARN_IO)) { + Perl_warner(aTHX_ packWARN(WARN_IO), + "telldir() attempted on invalid dirhandle %s", GvENAME(gv)); + } + goto nope; + } PUSHi( PerlDir_tell(IoDIRP(io)) ); RETURN; @@ -3765,9 +3770,13 @@ PP(pp_seekdir) GV * const gv = (GV*)POPs; register IO * const io = GvIOn(gv); - if (!io || !IoDIRP(io)) - goto nope; - + if (!io || !IoDIRP(io)) { + if(ckWARN(WARN_IO)) { + Perl_warner(aTHX_ packWARN(WARN_IO), + "seekdir() attempted on invalid dirhandle %s", GvENAME(gv)); + } + goto nope; + } (void)PerlDir_seek(IoDIRP(io), along); RETPUSHYES; @@ -3787,9 +3796,13 @@ PP(pp_rewinddir) GV * const gv = (GV*)POPs; register IO * const io = GvIOn(gv); - if (!io || !IoDIRP(io)) + if (!io || !IoDIRP(io)) { + if(ckWARN(WARN_IO)) { + Perl_warner(aTHX_ packWARN(WARN_IO), + "rewinddir() attempted on invalid dirhandle %s", GvENAME(gv)); + } goto nope; - + } (void)PerlDir_rewind(IoDIRP(io)); RETPUSHYES; nope: @@ -3808,9 +3821,13 @@ PP(pp_closedir) GV * const gv = (GV*)POPs; register IO * const io = GvIOn(gv); - if (!io || !IoDIRP(io)) - goto nope; - + if (!io || !IoDIRP(io)) { + if(ckWARN(WARN_IO)) { + Perl_warner(aTHX_ packWARN(WARN_IO), + "closedir() attempted on invalid dirhandle %s", GvENAME(gv)); + } + goto nope; + } #ifdef VOID_CLOSEDIR PerlDir_close(IoDIRP(io)); #else |