summaryrefslogtreecommitdiff
path: root/util.c
diff options
context:
space:
mode:
authorGurusamy Sarathy <gsar@cpan.org>2000-01-21 04:28:08 +0000
committerGurusamy Sarathy <gsar@cpan.org>2000-01-21 04:28:08 +0000
commit69282e910994b718c7eedc8f550888058a4e93ff (patch)
tree7b03bc1b24a50d77983c616709e61e9238cee94a /util.c
parent2decb4fb82e001e3c9671c57b61232c651a9c22c (diff)
downloadperl-69282e910994b718c7eedc8f550888058a4e93ff.tar.gz
patch to report warnings on bogus filehandles passed to flock(),
more consistent warnings, from Greg Bacon <gbacon@itsc.uah.edu> (slightly modified) p4raw-id: //depot/perl@4830
Diffstat (limited to 'util.c')
-rw-r--r--util.c23
1 files changed, 22 insertions, 1 deletions
diff --git a/util.c b/util.c
index 2ecb73a5cc..09fa02748b 100644
--- a/util.c
+++ b/util.c
@@ -3702,7 +3702,8 @@ Perl_my_fflush_all(pTHX)
}
NV
-Perl_my_atof(pTHX_ const char* s) {
+Perl_my_atof(pTHX_ const char* s)
+{
#ifdef USE_LOCALE_NUMERIC
if ((PL_hints & HINT_LOCALE) && PL_numeric_local) {
NV x, y;
@@ -3721,3 +3722,23 @@ Perl_my_atof(pTHX_ const char* s) {
return Perl_atof(s);
#endif
}
+
+void
+Perl_report_closed_fh(pTHX_ GV *gv, IO *io, const char *func, const char *obj)
+{
+ SV *sv;
+ char *name;
+
+ assert(gv);
+
+ sv = sv_newmortal();
+ gv_efullname3(sv, gv, Nullch);
+ name = SvPVX(sv);
+
+ Perl_warner(aTHX_ WARN_CLOSED, "%s() on closed %s %s", func, obj, name);
+
+ if (io && IoDIRP(io))
+ Perl_warner(aTHX_ WARN_CLOSED,
+ "(Are you trying to call %s() on dirhandle %s?)\n",
+ func, name);
+}