+ /* Don't bother if there's no *ENV glob */
+ if (!PL_envgv)
+ return;
+ /* If there's no %ENV hash or if it's not magical, croak, because
+ * it probably doesn't reflect the actual environment */
+ if (!GvHV(PL_envgv) || !(SvRMAGICAL(GvHV(PL_envgv))
+ && mg_find((const SV *)GvHV(PL_envgv), PERL_MAGIC_env))) {
+ const bool was_tainted = TAINT_get;
+ const char * const name = GvENAME(PL_envgv);
+ TAINT;
+ if (strEQ(name,"ENV"))
+ /* hash alias */
+ taint_proper("%%ENV is aliased to %s%s", "another variable");
+ else
+ /* glob alias: report it in the error message */
+ taint_proper("%%ENV is aliased to %%%s%s", name);
+ /* this statement is reached under -t or -U */
+ TAINT_set(was_tainted);
+#ifdef NO_TAINT_SUPPORT
+ PERL_UNUSED_VAR(was_tainted);
+#endif
+ }
+